This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-29
Channels
- # aleph (5)
- # announcements (2)
- # bangalore-clj (2)
- # beginners (52)
- # cider (10)
- # cljsrn (1)
- # clojure (160)
- # clojure-dev (24)
- # clojure-europe (3)
- # clojure-france (1)
- # clojure-india (1)
- # clojure-italy (3)
- # clojure-nl (6)
- # clojure-spec (13)
- # clojure-uk (51)
- # clojurescript (45)
- # code-reviews (1)
- # core-async (41)
- # cursive (41)
- # datomic (17)
- # emacs (37)
- # fulcro (42)
- # graphql (7)
- # joker (4)
- # music (1)
- # nrepl (2)
- # off-topic (21)
- # pathom (19)
- # pedestal (12)
- # re-frame (48)
- # reitit (6)
- # rewrite-clj (8)
- # shadow-cljs (41)
- # specter (6)
- # sql (21)
- # tools-deps (8)
- # vim (7)
- # xtdb (27)
Hello. Fairly new to datomic. I'm attempting to write a query that returns entities which have had attributes updated since a point in time. I can't figure out why the first two queries work great, but the third one just hangs for 30 seconds and return Server error
.
(d/q '[:find (pull ?e [*])
:in $all $new
:where
[$all ?e :customer/id]
[$new ?e :customer/first-name]]
db
(d/since db t))
(d/q '[:find (pull ?e [*])
:in $all $new
:where
[$all ?e :customer/id]
[$new ?e :customer/last-name]]
db
(d/since db t))
(d/q '[:find (pull ?e [*])
:in $all $new
:where
[$all ?e :customer/id]
(or [$new ?e :customer/first-name]
[$new ?e :customer/last-name])]
db
(d/since db t))
Check your datomic system logs to see if you had an exception or error in the 3rd one
@skuttleman I wonder if the or
clause can only target one src-var. Did you try to put the $new
before the or
clause? I never encountered this case. Does it mean you cannot write a or clause across src-vars?
For this kind of historical queries I would use the log API and check for the attributes I'm interested in in each transaction since t
.
@me1740 @marshall Thanks for responding. I ended up getting it to work last night after finding this: https://docs.datomic.com/on-prem/query.html#how-or-clauses-work
The or
clause can only target one src-var
(d/q '[:find (pull ?e [*])
:in $all $new
:where
[$all ?e :customer/id]
($new or
[?e :customer/first-name]
[?e :customer/last-name])]
db
(d/since db t))
In datomic ions, where would I put something I might normally do in a component/integrant system? e.g. create a postgresql hikari connection pool (yes, yes I know, but this is a clear example).
I'm using Mount in ions. The only thing that is mildly special is that I have some code in the root of a namespace which checks the environment. If the environment is not the desktop (ie, either :dev or :prod), it mounts the system
Parameters will still use the AWS parameter store in dev
get-env
will use local environment variable when running locally
Developers need to set that environment then? (Or I guess the application could default to dev, but that seems potentially dangerous depending on what you do in dev)
Generally no, if you mean something similar to SQL's ORDER BY
. In the peer model you'll typically do the sorting in your application code.