Fork me on GitHub

Hello everyone! Is there some more documentation/examples on how the EQL projection stuff works? Trying to figure out but doesn't seem it's enough for my brain with the three examples from the docs website. Particularly interested in the reverse joins


We've kept as much to EQL as possible, so their docs are a good reference for Crux as well - Crux's 'project' is currently in alpha, we've not added union or recursive queries as yet. Reverse joins aren't part of EQL - these are done by prefixing the attribute by an underscore

πŸ‘ 3

so, if I had two documents with a relationship between them (A referring to B, say) but I start my projection at B, I need to use the underscore-prefixed attribute to refer back to A

{:crux.db/id :a, :refers-to :b}
{:crux.db/id :b}
(crux/q db
        '{:find [(eql/project ?b [:crux.db/id {:_refers-to [:crux.db/id]}])]
          :where [[?b :crux.db/id :b]]})


#{[{:crux.db/id :b, 
    :_refers-to [#:crux.db{:id :a}]}]}


Yup, thanks! I got it all working as expected now, I think

simple_smile 3

ended up with something like this:

(crux/submit-tx @crux-node [[:crux.tx/put {:crux.db/id :website-1
                                             :website/id :website-1
                                             :website/name "My Website"
                                             :user/email "[email protected]"}]
                              [:crux.tx/put {:crux.db/id :page-1
                                             :page/id :page-1
                                             :page/website_id :website-1
                                             :page/name "First page"}]
                              [:crux.tx/put {:crux.db/id :page-2
                                             :page/id :page-2
                                             :page/website_id :website-1
                                             :page/name "Second page"}]])
    (query '{:find [(eql/project ?website [:website/name {:page/_website_id [:page/id :page/name]}])]
             :where [[?website :website/id ?id]]}))


Gah, as is tradition. Been trying to understand it since about a day ago. Five minutes after posting the message, my assumptions finally matches how it actually works... :face_palm:


often the way πŸ™‚

😁 3

You could look in query_test.clj too.


oooh, query_test.clj is really helpful, wish I found that earlier! Would be nice to have it linked from the docs website surely πŸ™‚


over time we'd migrating more and more examples from that one into the docs, certainly πŸ™‚


There's many places where the tests will be more comprehensive than the docs, we are trying our best to keep everything updated. However, peering into the test code is a good achievement to unlock πŸ™‚


yeah, keeping docs and tests in sync is always hard. is a interesting project trying to integrate the two better, maybe some inspiration could be had with that


Quick question, what is the story with storing blobs in Crux? I have looked around but not really found a good answers.


Hi, Crux doesn't store blobs natively today. Though we may yet add support. You could either wrap blobs in java objects and store them as serialised values, or use base64 What is your use-case? Is it cryptographic keys by any chance?


No, I’m making a small thing that’s going to allow users to record and store audio. But I think it is of such a small scale that I could just chuck them into the file system.


Having the same use case (storing images and vectors). Ended up writing the bytes to disk and storing the path instead

πŸ‘ 3

Although, the filename is the cryptographic hash of the content, so could be looked up from other hosts as well if needed


That sounds like the best solution, at least at this scale. thanks for the prompt replies!

πŸ™ 3

This method has served me well in the past. The only thing you need to remember is to implement some kind of garbage collection, unless you don’t mind your S3 bill. πŸ˜›


crux doesn't have a built-in way of doing something like datomic's reified transactions as shown at the bottom of this section: right?


Hi, correct there's nothing built-in for this, but you can create a transaction function to suit your exact requirements. e.g.

πŸ‘ 3

also, I noticed that in the last release notes mention of slack has been dropped.. I suppose you folks strongly prefer to use the zulip at this point?


We'll always be happy to chat here πŸ™‚ Clojurians Slack is a wonderful thing! Although for general "support" purposes the lack of proper threading and searchable history makes Slack pretty frustrating to work with. Also we're keen to not turn-off our potential non-Clojure users (esp. Java / Kotlin) by appearing to prioritise help for Clojure users


my crux jdbc connection broke when bumping from 20.05 to 20.09. A bug perhaps?

(crux/start-node {:crux.node/topology '[crux.jdbc/topology]
                     :crux.jdbc/dbtype   "postgresql"
                     :crux.jdbc/dbname   (:dbname config)
                     :crux.jdbc/host     (:host config)
                     :crux.jdbc/user     (:user config)
                     :crux.jdbc/port     (:port config)
                     :crux.jdbc/password (:password config)


Execution error (IllegalArgumentException) at crux.system/opts-reducer$f (system.clj:127).
Unexpected config option 15432


It's complaining about the port option (:port config) ;; => 15432



;; before {:crux.node/topology '[crux.jdbc/topology]  :crux.jdbc/dbtype "postgresql"  :crux.jdbc/dbname "cruxdb"  :crux.jdbc/host "<host>"  :crux.jdbc/user "<user>"  :crux.jdbc/password "<password>"}  ;; after - shared connection pool {::jdbc/connection-pool {:dialect 'crux.jdbc.psql/->dialect                          :db-spec {:dbname "cruxdb"                                    :host "<host>"                                    :user "<user>"                                    :password "<password>"}}  :crux/tx-log {:crux/module `crux.jdbc/->tx-log, :connection-pool ::jdbc/connection-pool}  :crux/document-store {:crux/module `crux.jdbc/->document-store, :connection-pool ::jdbc/connection-pool}  :crux/index-store {...}}

πŸ™ 3


βž• 3