Fork me on GitHub
#datomic
<
2020-07-14
>
deadghost03:07:59

Did datomic cloud lose the collection find spec that was in on-prem? :find [?release-name ...] https://docs.datomic.com/on-prem/query.html#find-specifications https://docs.datomic.com/cloud/query/query-data-reference.html#find-specs. I haven't found cloud docs on it and it doesn't look like it's working when I've tried it in the REPL.

favila05:07:57

Yep, cloud query cannot destructure in :find

favila05:07:16

(Actually client api query)

deadghost12:07:31

If datomic cloud doesn't have the collection find spec, what is the recommended way to return a collection instead? Massage it on the programming language level?

favila12:07:45

that’s all it was doing anyway.

favila12:07:18

[?a …] => (map peek results)

favila12:07:27

[?a ?b] => (first results)

favila12:07:35

?a . => (ffirst results)

unbalanced13:07:47

what's the preferred method of daemonizing the transactor on a linux server?

favila14:07:53

Just the general unix advice? Don’t daemonize: manage the process with an init system like systemd

ghadi14:07:20

would also recommend a systemd unit

unbalanced15:07:07

got it. yep that's exactly the advice I was looking for. Also I thought systemd was a daemonization process?? Maybe I'm just confused on terminology. I meant "robust way to run the thing in the background better than a screen session"

favila16:07:52

are you just running a one-off transactor in a terminal? screen, new terminal tab, or even bash job-control is fine

favila16:07:14

are you running in production as a service? use a process manager

favila16:07:14

by “don’t daemonize” I mean don’t do the double fork/join “daemon” mode of older style inits

favila16:07:35

where the transactor gets detached from its parent process

ghadi16:07:14

let systemd sort it out

ghadi16:07:30

systemd supports daemonization but it's not the preferred default service type

Jon Walch16:07:27

Has anyone set up dev-local with lein?

kenny18:07:33

We uploaded dev-local to a private s3 repo and bring it in with tools-deps s3 support. I think lein has a s3 wagon to do the same.

👍 3
marciol16:07:57

Hi, most probably someone already asked if in some point in the future Datomic Cloud will allow queries across databases. It’d be very nice to have in certain cases when working with sharded databases.

kenny16:07:42

A query can take in multiple dbs.

marciol16:07:41

There was a limitation, but seems to be solved now, can you confirm it @U083D6HK9?

marciol16:07:54

Good news indeed!

kenny16:07:14

Depends on what limitation you're referring to.

marciol16:07:50

@U083D6HK9 I read in the current #datomic channel and here also: https://forum.datomic.com/t/filtering-and-multi-database-queries/481 that cross join is not allowed when one is using Datomic Cloud.

timcreasy16:07:31

(Just following this conversation in case there has been an update, as we’ve been handling joins in client code)

marciol17:07:59

Great @U4Z2TFMJ9, I’m reading the Datomic Cloud documentation and seems to be the case. Sometimes is a little bit painful to revisit all docs to know if something changed. Maybe the Release Notes is the best place to be aware of all changes.

kenny17:07:28

We have code that queries Datomic like the last query in that blog post.

timcreasy17:07:57

Yeah, thanks @U28A9C90Q. I think @U083D6HK9 rightly pointed out that query can take in multiple dbs, however it appears in cloud those dbs must be the same.

(d/q {:query '[:find (count ?a)
               :in $1
               :where
               [$1 _ :db/ident ?a]]
      :args [db-1]})
=> [[661]]
(d/q {:query '[:find (count ?a)
               :in $2
               :where
               [$2 _ :db/ident ?a]]
      :args [db-2]})
=> [[68]]
(d/q {:query '[:find (count ?a)
               :in $1 $2
               :where
               [$1 _ :db/ident ?a]
               [$2 _ :db/ident ?a]]
      :args [db-1 db-2]})
Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
Query db arg does not match connection
I’ve always based the fact that it’s unsupported off this: https://docs.datomic.com/on-prem/clients-and-peers.html

kenny17:07:32

Oh, right - I misread the q. Our queries only ever cross the same connection.

kenny17:07:43

> Sometimes is a little bit painful to revisit all docs @U28A9C90Q They post releases to https://forum.datomic.com/c/datomic-gen/announcements/6. You can follow it for updates.

kschltz17:07:07

Hi there, I was wondering what tools are mostly used when monitoring datomic cloud, I mean are there any other options other than cloud watch?

bamarco18:07:46

I am trying to write basic ping functionality with a websocket ion, but it is failing with the error:

no protocol: <api-id>.>: datomic.ion.lambda.handler.exceptions.Incorrect
clojure.lang.ExceptionInfo: no protocol: <api-id>.> {:cognitect.anomalies/category :cognitect.anomalies/incorrect, :cognitect.anomalies/message "no protocol: <api-id>.
	at datomic.ion.lambda.handler$throw_anomaly.invokeStatic(handler.clj:24)
	at datomic.ion.lambda.handler$throw_anomaly.invoke(handler.clj:20)
	at datomic.ion.lambda.handler.Handler.on_anomaly(handler.clj:171)
	at datomic.ion.lambda.handler.Handler.handle_request(handler.clj:196)
	at datomic.ion.lambda.handler$fn__3841$G__3766__3846.invoke(handler.clj:67)
	at datomic.ion.lambda.handler$fn__3841$G__3765__3852.invoke(handler.clj:67)
	at clojure.lang.Var.invoke(Var.java:399)
	at datomic.ion.lambda.handler.Thunk.handleRequest(Thunk.java:35)
I am using the following code
clj
(defn messages-lambda [{:keys [input context]}]
  (let [input (-> input
                 (json/parse-string true)
                 (update-in [:body] json/parse-string true))
        {:as response :keys [::recipients]} (action input)
        response (-> response
                   (dissoc ::recipients)
                   )]
    (doseq [id recipients]
      (try
        (cast/event {:msg "messages-lambda"
                     :response (str response)
                     :url (send-url input id)})
        (client/post (send-url input id) {:form-params {:action "pong"}, :content-type :json})
        (catch clojure.lang.ExceptionInfo e
          (let [{:keys [status reason-phrase]} (ex-data e)]
            (cast/event {:msg "messages-lambda" :status status :reason reason-phrase})
            (far/delete-item nil sockets-table {:connection-id id}))))
    (json/generate-string {:statusCode 200}))))
I get the event msg
{"Msg": "messages-lambda",
    "Response": "{:action :pong}",
    "Url": "<api-id>.>",
    "Type": "Event",
    "Tid": 65,
    "Timestamp": 1594749027640}