Fork me on GitHub
#datomic
<
2023-02-07
>
jdkealy16:02:13

Is there a way to query only for updates ? i.e. if i had an attribute :session/start_time and i want to only query for ents where :session/start_time was overwritten ?

hanDerPeder16:02:35

Havent tried, but I think you could take the last example from https://docs.datomic.com/on-prem/getting-started/see-historic-data.html and add '?tx true' to the last where clause. Sort by tx and all but the first are updates.

hanDerPeder16:02:30

Ah sorry, didnt read your question we'll enough.

hanDerPeder16:02:06

You could use datoms with the aevt index for this. Scanning all values evt's. Not sure if there is a quicker way.

cjohansen17:02:35

(->> (d/q '[:find ?v ?tx
            :in $ ?e
            :where
            [?e :session/start-time ?v ?tx true]]
          (d/history db)
          eid)
     (sort-by second)
     (drop 1))

cjohansen17:02:42

For one specific entity

cjohansen17:02:27

Actually, since Datomic always retracts the old value before writing a new one you can do this:

(d/q '[:find ?v2 ?tx
       :where
       [?e :session/start-time ?v2 ?tx true]
       [?e :session/start-time ?va ?tx false]]
     (d/history db))
This will give you all updates without the initial assert

👍 2
Daniel Jomphe20:02:23

https://docs.datomic.com/cloud/analytics/analytics-concepts.html still refers to Presto instead of Trino in 20 occurrences across the following set of pages, is that OK?

Daniel Jomphe20:02:17

There are 26 more occurrences in the https://docs.datomic.com/cloud/analytics/analytics-other.html section's pages also, for a total of 46 across both sections.

Daniel Jomphe20:02:04

With that said, I guess (or I know) you're hard at work preparing the next release of Datomic Cloud, and that's way more important than updating these docs - I'd say this is true at least until you eventually release a backup-restore solution; but still, let's see this as a signal that we spend a bit of time uselessly investigating the differences between Presto and Trino because of this. 🙂

favila21:02:49

The release in use now (348) is from the trino fork, but before they renamed it to trino. I’m not sure there’s a not-confusing way to explain this 🙂 Witness my confusion last year: https://clojurians.slack.com/archives/C03RZMDSH/p1655476628432899

Daniel Jomphe22:02:06

Yeah, I read that last week when I was making my way through the docs. 🙂 Your reply helped me make sense right now of this, though, so thanks a lot!

Daniel Jomphe22:02:59

This here seems to be legacy information, not updated with the newish info (I can confirm once I try it; the good values should be easy to find).

Daniel Jomphe22:02:17

This would also seem to be outdated info.

jaret12:02:32

Hi @U0514DPR7 Thanks! We intentionally left it as presto because that is the name of the version (348) we are using (right before the name switch). The name switch happened after we released Analytics and we have not returned to see about upgrading to a newer version from Trino. Your points stand and I will work with the team to see what we can do to make this clearer.

2