This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-30
Channels
- # admin-announcements (1)
- # adventofcode (2)
- # announcements (2)
- # babashka (60)
- # beginners (48)
- # cherry (1)
- # cider (16)
- # clj-kondo (4)
- # clojure (53)
- # clojure-belgium (3)
- # clojure-europe (20)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-poland (4)
- # clojure-uk (6)
- # clojuredesign-podcast (19)
- # clojurescript (39)
- # community-development (12)
- # cursive (4)
- # datalevin (7)
- # datomic (23)
- # honeysql (14)
- # hyperfiddle (3)
- # instaparse (3)
- # lsp (3)
- # malli (10)
- # off-topic (34)
- # overtone (8)
- # polylith (2)
- # re-frame (9)
- # reitit (3)
- # releases (1)
- # squint (16)
- # timbre (7)
- # wasm (2)
- # xtdb (8)
Hello! how are you? I'm fairly new to datomic, and was wondering if there is a docker image or similar reference for setting up datomic on top of postgresql
w/the caveat that I haven’t used it, this exists: https://github.com/galuque/datomic-compose and looks similar to other datomic + postgres docker compose solutions I’ve seen in private code in various places.
RUN curl -O
RUN unzip datomic-pro-${datomic_version}.zip
RUN mv datomic-pro-${datomic_version}/* /opt/datomic
So, I’ve got a collection of ids, and I need to find which of these ids don’t exist in my datomic database. I could pull back all of the records that do exist, and filter them out, but that seems inefficient if my DB gets big. I’m able to write a simple query to do this if I’m looking at one and only one attribute: (e.g.)
(d/q '[:find ?id
:in $ [?id ...]
:where
(not
[_ :observed-record/record-id ?id])]
(d/db conn)
'("not-in-db" "in-db")) => [["not-in-db"]]
However, I can’t find a way to make it work when I’m looking at two attributes: (e.g.)
(d/q '[:find ?id
:in $ ?namespace [?id ...]
:where
(not-join [?id]
(and
[?e :observed-record/namespace ?namespace]
[?e :observed-record/record-id ?id]))]
(d/db conn)
"my-namespace"
'("not-in-db" "in-db"))
=> ; processing rule: (q__23841 ?id), message: Syntax error compiling at (0:0).
Any ideas how to make the second query work?Probably just an error in creating the example for Slack, but where is the db arg to d/q
?
Fixed. Using some tool that had partially applied the db already.
In addition to ?id
, you might need to require that ?namespace
be bound before the not-join (which it is, but it can’t hurt to signal this to the query parser)
Ah. That’s it. No and
s in not-join
. That fixed it.
And now I’m wondering why I thought it did need an and
:face_with_spiral_eyes:
@U0698L2BU Out of curiosity, how would I signal that to the query parser?
that would work too. not
gets moved around to the highest spot that still satisfies its bindings. not can’t work without everything being bound that it unifies with, because it doesn’t produce rows, it removes them
Huh. Given that I didn’t provide ?namespace
in the (not-join […]) here, how would that have even worked?