This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-24
Channels
- # announcements (6)
- # architecture (9)
- # aws (2)
- # babashka (49)
- # beginners (160)
- # boot (19)
- # calva (9)
- # cider (16)
- # clj-kondo (17)
- # cljfx (9)
- # clojure (143)
- # clojure-australia (5)
- # clojure-berlin (1)
- # clojure-czech (3)
- # clojure-europe (64)
- # clojure-france (1)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-spec (6)
- # clojure-uk (47)
- # clojurescript (27)
- # code-reviews (5)
- # conjure (45)
- # cursive (47)
- # datascript (2)
- # datomic (21)
- # events (1)
- # fulcro (9)
- # graalvm (4)
- # graphql (2)
- # jackdaw (22)
- # jobs (3)
- # kaocha (6)
- # london-clojurians (1)
- # luminus (4)
- # malli (19)
- # meander (136)
- # pathom (4)
- # pedestal (2)
- # re-frame (15)
- # reitit (2)
- # remote-jobs (2)
- # rum (12)
- # sci (1)
- # shadow-cljs (100)
- # spacemacs (10)
- # sql (1)
- # tools-deps (30)
- # vrac (1)
- # xtdb (30)
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 - https://edn-query-language.org/eql/1.0.0/what-is-eql.html 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
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]]})
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"}]])
(pprint
(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:
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. https://github.com/seancorfield/readme 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
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!
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: https://vvvvalvalval.github.io/posts/2018-11-12-datomic-event-sourcing-without-the-hassle.html#processing_events_with_datomic right?
Hi, correct there's nothing built-in for this, but you can create a transaction function to suit your exact requirements. e.g. https://gist.github.com/refset/a00be06443bc03ccc84a2874af3cdb8a#file-txfns-clj-L1-L8
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
take a look at https://github.com/juxt/crux/blob/20.09-1.12.0/docs/topo-migration.adoc
especially
;; 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 {...}}