This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-29
Channels
- # announcements (2)
- # babashka (18)
- # beginners (42)
- # calva (56)
- # chlorine-clover (35)
- # clara (9)
- # clj-http (1)
- # clj-kondo (19)
- # cljs-dev (8)
- # clojure (14)
- # clojure-europe (23)
- # clojure-france (7)
- # clojure-norway (6)
- # clojure-uk (3)
- # clojurescript (37)
- # community-development (3)
- # cursive (29)
- # datomic (3)
- # emacs (10)
- # events (2)
- # fulcro (77)
- # hyperfiddle (2)
- # introduce-yourself (4)
- # joker (1)
- # lsp (40)
- # malli (52)
- # meander (7)
- # missionary (16)
- # off-topic (3)
- # pedestal (1)
- # re-frame (5)
- # reitit (38)
- # releases (1)
- # shadow-cljs (4)
- # tools-build (18)
- # tools-deps (1)
- # xtdb (8)
Will this library make writing queries a bit easier? https://github.com/brandonbloom/backtick
Potentially 🙂 generally speaking, I've always found standard literal quoting and the ability to operate on quoted forms ergonomic enough (e.g. (assoc '{:find [...] :where [...]} :in (vector 'x 'y 'z))
)
are you thinking about this for generating queries? or for maintaining hand-written queries?
Yeah. Agree with you. I'm doing hard-written queries. I had a clause to check if an attribute is in a set. I used '[[e? :a v?] [(contains vs v?)]]
, with the vs part of :in . Then I thought it's better to do: '[[e? :a vs]]
I can also do [['e? :a vs]]
without having vs part of :in . Am I correct here?
> I can also do `[['e? :a vs]]` without having vs part of :in . Am I correct here? yep that works too, there's a slight compilation performance cost with query caching (since technically it's a new query each time!) but that's usually far from being a bottleneck
another aspect to consider is this other caveat about query planning when using :in
https://github.com/xtdb/xtdb/issues/1447
Is this a bug? I have a models passed in but not used in the query. It returns different results with different models passed in.
user=> (xt/q (xt/db node) {:find '[(pull v? [*]) ] :where [['v? :x/type :v] '[(get-attr v? :v/model "") [model? ...]] ] :in '[[models ...]]} [])
#{}
user=> (xt/q (xt/db node) {:find '[(pull v? [*]) ] :where [['v? :x/type :v] '[(get-attr v? :v/model "") [model? ...]] ] :in '[[models ...]]} [""])
#{... } ; some records returned
To answer my own question: if I remove the unused collection arg from :in, it works as expected. Though I feel unused param should not affect returned results instead of returns no results. Submitted jira: https://github.com/xtdb/xtdb/issues/1680