This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-23
Channels
- # announcements (11)
- # architecture (14)
- # babashka (34)
- # bangalore-clj (8)
- # beginners (108)
- # calva (10)
- # cider (19)
- # circleci (9)
- # clj-kondo (19)
- # clojars (4)
- # clojure (62)
- # clojure-australia (2)
- # clojure-europe (62)
- # clojure-italy (14)
- # clojure-nl (8)
- # clojure-poland (1)
- # clojure-spec (14)
- # clojure-uk (59)
- # clojurescript (14)
- # community-development (5)
- # conjure (2)
- # core-async (10)
- # cryogen (1)
- # cursive (11)
- # data-science (1)
- # datahike (13)
- # datomic (21)
- # deps-new (4)
- # ethereum (1)
- # events (4)
- # fulcro (34)
- # helix (2)
- # jobs (2)
- # juxt (33)
- # kaocha (4)
- # lsp (18)
- # malli (4)
- # membrane (2)
- # off-topic (23)
- # re-frame (3)
- # reitit (4)
- # remote-jobs (1)
- # reveal (6)
- # shadow-cljs (47)
- # slack-help (2)
- # spacemacs (5)
- # sql (45)
- # startup-in-a-month (6)
- # testing (4)
- # tools-deps (21)
- # xtdb (4)
Hi, I’m new to Datomic and am looking for some direction in where to learn more about what I’m trying to achieve. I’m trying to ‘mix’ a query and a pull expression in a way that I suspect pull doesn’t allow for. If that is the case is there a more verbose way of achieving what I’m trying to do.
I’m trying to do a ‘filter’ at multiple levels of the return result. In other words I’m trying to return things
that have at least one sub-thing
that itself has an-attr
that is "foobar"
and only the sub-thing
s that match the sub-thing
clause.
'[:find (pull ?thing [:things/field-1 :things/field-etc {:things/sub-things [*]}])
:in $
:where
[?thing :things/sub-things ?sub-things]
[?sub-things :sub-thing/an-attr "foobar"]]
As far as I understand the pull crawls from ?thing
after the query has run so it makes sense in the above query I get all the sub-things
and not just the ones that match. But I would really like to constrain the pull expression result somewhat.
My real case is more complicated than that and needs to solve the general case. As for solutions I could post process the results of the pull or I could not use pull but then the problem becomes how to construct the tree results using a raw :find clause. If the latter is at all possible (it doesn’t seem like it) is there any resources someone could point me at? The find spec docs seem to me to not support this. A third possible option would be to use nested-queries.
Sorry for the vague question! Any advice or pointers would be much appreciated 🙂eYou can include two pulls in the find clause. You can also do a reverse pull from sub-thing to thing for only matching sub-things.
The reverse pull is a good pointer thanks! The problem is that both of those require post processing to piece the original tree back together because I have an arbitrary amount of these filters to accommodate. What I really need (and I’m pretty sure I understand why it doesn’t work that way) is to be able to unify (I think that’s the right word) the logic variables into the pull expression
You can't unify lvars in the pull pattern of the pull expression (interesting idea though!)
You can always issue pulls after the query returns. If your code is in a peer or an ion it's already resident in the db process anyways so those pulls will be just as fast as what d/q
does.
Thanks… that’s a good point about subsequent queries being fast as it’s not on a server somewhere else; I need to let that really sink in properly
Hi everyone, maybe stupid question, but can I use more recent version of datomic api (eg 1.0.6165) with less recent version of datomic transactor (eg 0.9.6045)? The reasoning behind that is I'd like to try qseq
and other added perks without upgrading infrastructure.
Just to mention - I tried and it works, just curious if there are any downsides with such approach
We always recommend upgrading both (as a member of the Datomic team) 🙂. But while the configuration is not expressly supported all versions are backwards compatible and cross versions work between peer and transactor. If you encounter any particular issue do let me know by shooting an e-mail to <mailto:[email protected]|[email protected]>
thanks @U1QJACBUM
The caveat to this is there are some extremely old versions that would have some issues with local storage and potentially the introduction of versions spanning schema changes (i.e. the addition of tuples) may encounter some issues.
hey folks, is datomic console available with dev-local/cognitect dev tools? Or only for starter/pro/enterprise users?
Datomic Console is shipped with Datomic on-prem. Not shipped with cognitect dev tools. Dev tools includes REBL and dev-local.
If you want to Download Console you can do so from my.datomic: https://my.datomic.com/downloads/console
@U1QJACBUM console is not currently available for cloud, is that right?