This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-18
Channels
- # announcements (6)
- # babashka (16)
- # beginners (194)
- # calva (20)
- # cider (34)
- # clj-kondo (38)
- # clojure (89)
- # clojure-europe (10)
- # clojure-finland (15)
- # clojure-italy (2)
- # clojure-nl (15)
- # clojure-sg (7)
- # clojure-spec (15)
- # clojure-uk (86)
- # clojurebridge (1)
- # clojurescript (60)
- # community-development (11)
- # conjure (13)
- # core-async (48)
- # core-typed (3)
- # cursive (22)
- # datascript (8)
- # datomic (40)
- # duct (11)
- # emacs (3)
- # figwheel-main (22)
- # fulcro (45)
- # graphql (1)
- # helix (9)
- # hoplon (15)
- # hugsql (7)
- # jobs-discuss (47)
- # juxt (7)
- # kaocha (21)
- # luminus (1)
- # malli (13)
- # meander (2)
- # off-topic (52)
- # parinfer (19)
- # re-frame (66)
- # reagent (1)
- # reitit (3)
- # ring-swagger (1)
- # rum (2)
- # shadow-cljs (72)
- # spacemacs (5)
- # sql (4)
- # timbre (5)
- # tools-deps (15)
- # vim (5)
- # vrac (7)
Shoot, how should i start with free version instead?
I need to play around. Will use in a project and i want to have a hands on experience
Thank you all : )
following up on a question i asked the other day, i am trying to pass the result of a query through a serialization library, and i am having trouble making sense of an error. upon def'ing the result i can see that it is a clojure.lang.PersistentVector
(def result (d/q ... db)
=> #'my-ns/result
(type result)
=> clojure.lang.PersistentVector
and a postwalk through the data structure shows only core java/clojure classes
(clojure.lang.PersistentVector
clojure.lang.PersistentHashMap
clojure.lang.MapEntry
clojure.lang.Keyword
clojure.lang.PersistentArrayMap
java.lang.String
java.lang.Boolean)
however, when i pass result
to the serialization library, i get a NotSerializableException
for datomic.client.impl.shared.Db
.
(sp/set bc "testkey" 120 result)
Execution error (NotSerializableException)
at java.io.ObjectOutputStream/writeObject0 (ObjectOutputStream.java:1185).
datomic.client.impl.shared.Db
how is the datomic.client.impl.shared.Db
class related to the result of the query?everything works as expected if i copy and paste the contents of result
back in to the repl, so there's definitely something going on with the object itself
it does indeed. and the query result vector does have a nav protocol:
(meta result)
=>
#:clojure.core.protocols{nav #object[clojure.core$partial$fn__5839 0x613ebeb5 "clojure.core$partial$fn__5839@613ebeb5"]}
(meta (vary-meta result dissoc clojure.core.protocols/nav))
=>
#:clojure.core.protocols{nav #object[clojure.core$partial$fn__5839 0x613ebeb5 "clojure.core$partial$fn__5839@613ebeb5"]}
there could still be metadata on nested objects. I didnât know the client lib made results navigable and I donât know how it works
favila, once again, thanks for your help. i shrugged off the metadata earlier when i saw only the nav protocol. but sure enough stripping it away solved the problem
âonly the nav protocolâ these are always live objects (functions) so I donât expect them to be serializable ever
agreed, and i did find that while stripping the top level metadata worked in my one example, other query results had nested metadata that could not be serialised (as you suspected). for now it is a hobby project, so a simple postwalk to remove all metadata works with the least amount of effort, but i will explore the serialization library for a more solid solution.
hello, can anyone explain me what I have to do to make this query work?
{:find '[[?e ...]]
:in '[$ ?date-from ?date-to]
:args [db date-from date-to]
:where '[[?e :logistic/driver ?d]
[?e :logistic/delivery-date ?date]
(not [?d :driver/external? true])
[(get-else $ ?e :logistic/completed #inst "2000") ?completed-date]
(or
(and [?e :logistic/state :logistic.state/incomplete]
[(<= ?completed-date ?date-to)])
[?e :logistic/state :logistic.state/active]
(and (or [?e :logistic/state :logistic.state/completed]
[?e :logistic/state :logistic.state/failed])
[(<= ?date-from ?completed-date)]
[(<= ?completed-date ?date-to)]))]}
Moved all the and/or
clauses to external function, and it works. I have no idea about theirs magic inside datomic
this has to do with whether a var should be unified with the outside of the rule or not
invisibly, or
is creating a rule, and each rule must unify to the same set of vars outside the rule
Thanks. But it seems too complicated for me, looks like much simplier is to use an external function with predictable behavior...
Is there a way to get datomic change log updates via some notification?
@drewverlee you can subscribe to the Announcements topic on the datomic forum
great thanks!