Fork me on GitHub
#datomic
<
2018-12-20
>
lwhorton07:12:45

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.

lwhorton17:12:21

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?

val_waeselynck17:12:13

@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]

lwhorton17:12:13

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

val_waeselynck17:12:57

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

lwhorton17:12:49

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.

claudiu09:12:29

is there any way to distinguish in aws "cost explorer" between prod/solo stacks ?

val_waeselynck12:12:08

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:

val_waeselynck12:12:55

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?

marshall13:12:34

Val, can you file a support ticket and we can help troubleshoot

eoliphant12:12:25

any update on this? We’ve run into something similar but more sporadically

Dustin Getz13:12:04

: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

val_waeselynck13:12:07

To stop wondering about this stuff, I've personally decided to always use not-join over not 🙂

Dustin Getz13:12:56

Thanks, not-join made the problem super obvious

Dustin Getz15:12:00

Why is :db.fn/cas -> :db/cas but :db.cardinality/many is not :db/many ?

lwhorton17:12:52

semantically isn’t one a function and the other an ident?

lwhorton17:12:07

not really an answer, but maybe cardinalities were namespaced for clarity and functions remain top level for convenience?

Dustin Getz17:12:11

it's either historical, or there is a deep reason i dont see

Dustin Getz17:12:51

but if something is going to be changed, why change :db.fn only

igrishaev20:12:43

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?

igrishaev20:12:24

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

Dustin Getz21:12:44

invoke clojure.core/= on a set instance

eraserhd22:12:45

@igrishaev You need double negation: find an account such that there is not an interest on the request that is not on the account.

igrishaev05:12:45

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?

tomjack22:12:30

hah, does that perform well assuming the desired strategy is to scan through all accounts? I guess I can try it myself

Dustin Getz23:12:29

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)))))