This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-20
Channels
- # adventofcode (47)
- # announcements (3)
- # aws (29)
- # bangalore-clj (3)
- # beginners (63)
- # boot (2)
- # braveandtrue (40)
- # calva (34)
- # cider (37)
- # cljs-dev (8)
- # clojars (3)
- # clojure (45)
- # clojure-europe (2)
- # clojure-france (4)
- # clojure-india (2)
- # clojure-italy (44)
- # clojure-japan (4)
- # clojure-nl (39)
- # clojure-serbia (1)
- # clojure-spec (21)
- # clojure-uk (75)
- # clojurescript (28)
- # cursive (24)
- # data-science (3)
- # datomic (31)
- # emacs (13)
- # fulcro (35)
- # hoplon (21)
- # jobs-discuss (66)
- # nrepl (18)
- # off-topic (72)
- # pathom (35)
- # re-frame (20)
- # reagent (54)
- # shadow-cljs (35)
- # spacemacs (9)
- # specter (8)
- # sql (13)
- # testing (9)
- # tools-deps (21)
- # vim (3)
what is the right approach to handle as-of
queries as the schema evolves? if you do it wrong, i imagine that adding a datom to an entity then updating a query to look for that datom is essentially breaking any functionality as-of
might offer? the entity as of the time the new attribute was appended can no longer be queried via as-of
since it doesn’t actually have that attribute at any point in the past, right? unless i’m mistaken and there’s an equivalent/corollary “join with an entity already known to the db” that since
filters have to consider.
@U0W0JDY4C you may want to look at this: https://vvvvalvalval.github.io/posts/2017-07-08-Datomic-this-is-not-the-history-youre-looking-for.html
so is there no way to join an entity (prev unavailable attrs with newly added attrs) or use something like get-else
or just or
?
@U0W0JDY4C not sure that answers your question, but you can put the actual db you want at the beginning of a Datalog clause [$past ?e :first-name ?past-first-name] [$current ?e :first-name ?present-first-name]
i suppose that could work — select with an as-of db the entity with the new value, and join on the entity with an as-of db where the attribute doesn’t yet exist
Cool - but again, you're probably doing something you shouldn't attempt in the first place IMHO - your application code should not use as-of
yea, i think you’re right, im still trying to wrap my head around it though. kind of a bummer because i thought i could implement a “novelty” report wrt revenue projections, etc.
I'm really struggling to get a batch import job to work reliably with Datomic Cloud. I'm running it from a an EC2 instance in the same VPC as my Cloud stack (prod, i3.xlarge), with a client arg-map looking like so:
{:server-type :cloud
:region "eu-central-1"
:system "linnaeus"
:endpoint " "
:timeout (* 1000 60 5)}
Connecting to the db (via d/connect
) fails 3 out of 4 times with a Datomic Client Timeout
error, and even when that works d/transact
fails after a few Transactions with a Service Unavailable
error:Exponential backoff doesn't help, even after several minutes. The EC2 nodes of the Datomic stack exhibit a near-zero utilization in terms of CPU, memory and network, while the Cloudwatch metrics show a constant HttpEndpointAsyncTimeout
of 1.0.
What's driving me crazy is that these failures seem so random. Everything works fine for a dozen txes, and then after virtually no load I get 100% failure.
What might be causing this?
@U05120CBV here you go: https://forum.datomic.com/t/difficulties-connecting-to-production-system-for-batch-imports/750
:where [?e :crm/tag ?tag] (not [(#{:lead} ?tag)])
results in error "Join variables should not be empty" {:error :parser/where, :form (not [(#{:lead} ?tag)])}
but removing the not works fine, whats up
To stop wondering about this stuff, I've personally decided to always use not-join
over not
🙂
Thanks, not-join made the problem super obvious
Why is :db.fn/cas -> :db/cas but :db.cardinality/many is not :db/many ?
not really an answer, but maybe cardinalities were namespaced for clarity and functions remain top level for convenience?
it's either historical, or there is a deep reason i dont see
but if something is going to be changed, why change :db.fn only
I’ve got an account model that has interests, which is an array of strings (db.type string with cardinality = many). Then another list of interests come from request. How can I query accounts what have ALL the specified interests?
In query, Datomic compares values one-by-one so I’ll have accounts who have at least one interest from the list. But I need all the interests
invoke clojure.core/= on a set instance
@igrishaev You need double negation: find an account such that there is not an interest on the request that is not on the account.
Could you give me a tip please? What I have is
'[:find ?id
:in $ ?a [?interest ...]
:where
[?a :account/id ?id]
(not-join [?a]
[?a :account/interests ?interest])]
but I got stuck with that. It returns accounts without passed interests. How can I revert the logic?hah, does that perform well assuming the desired strategy is to scan through all accounts? I guess I can try it myself
Anyone who likes types want to help me understand what the heck is going on in here?
(defn normalize-result [qfind result]
; This function confuses me. I am trying to explode it to its essence.
; mapv is coupled to vector, how could this be generalized to reactive collections?
(let [vector vector
mapv mapv]
(when result ; unclear if nil result is server error
(condp = (type qfind)
FindRel result
FindColl ((partial mapv vector) result)
FindTuple ((partial mapv vector) result)
FindScalar ((comp vector vector) result)))))