This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-04
Channels
- # announcements (1)
- # babashka (41)
- # beginners (124)
- # cider (8)
- # clj-kondo (25)
- # cljs-dev (40)
- # clojars (4)
- # clojure (92)
- # clojure-europe (35)
- # clojure-italy (3)
- # clojure-nl (4)
- # clojure-uk (91)
- # clojuredesign-podcast (8)
- # clojurescript (41)
- # code-reviews (1)
- # cursive (11)
- # data-science (1)
- # datascript (76)
- # datomic (45)
- # emacs (4)
- # etaoin (3)
- # events (1)
- # figwheel-main (2)
- # fulcro (9)
- # graalvm (1)
- # jackdaw (6)
- # jobs (1)
- # jobs-discuss (3)
- # kaocha (4)
- # malli (25)
- # off-topic (42)
- # pathom (4)
- # reitit (11)
- # releases (2)
- # reveal (1)
- # shadow-cljs (53)
- # sql (4)
- # tools-deps (190)
- # vrac (19)
- # xtdb (6)
Hello! I'm trying the EQL projections with an exemple similar to the one in the documentation
(I'm using "20.09-1.11.0-beta"
)
(crux/submit-tx node
[[:crux.tx/put {:crux.db/id 1, :user/name "Ivan", :user/profession {:profession/name "Doctor"}}],
[:crux.tx/put {:crux.db/id 2, :user/name "Sergei", :user/profession {:profession/name "Lawyer"}}]
[:crux.tx/put {:crux.db/id 3, :user/name "Petr", :user/profession {:profession/name "Doctor"}}]])
(crux/q (crux/db node)
'{:find [(eql/project ?user [:user/name {:user/profession [:profession/name]}])]
:where [[?user :user/name ?uname]]})
but my query strangly evaluates to this:
(the :user/profession
is empty))
#{[#:user{:name "Ivan", :profession {}}]
[#:user{:name "Petr", :profession {}}]
[#:user{:name "Sergei", :profession {}}]}
Am I missing something ? Is it a bug ?
Thank you 🙂your document structure is odd; presumably you want to store :user/profession "Doctor"
and then on another document (think of it as a table) you might have some entity with :profession/name "Doctor" :profession/salary 10000
and you can access salary from within the [`:profession/name`] vec in your query
Hi again! So I think the issue here is that you are storing a map as a value and our current EQL implementation can't peek inside that map value. So with that existing doc structure you would have to do an update-in
+ select-keys
from Clojure after the query results have been returned
it looks like crux can't store byte-arrays; that's kind of surprising, are those hard to index? specifically I'd like to store the sha256 hash buddy.core gives me
There's no particular reason why we can't support byte-array values, it's just not yet been a priority so far. You're not the first person to mention it though, (incidentally, also in relation to cryptographic keys!), so it is definitely on our radar. For the time being you can either wrap your byte-array inside a Java object (that Nippy can efficiently serialise), or you have to use base64