This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-05
Channels
- # announcements (1)
- # asami (21)
- # aws (19)
- # babashka (37)
- # beginners (38)
- # clj-kondo (7)
- # clj-otel (8)
- # clojure (29)
- # clojure-europe (54)
- # clojure-nl (3)
- # clojure-spec (2)
- # clojure-uk (2)
- # clojurescript (15)
- # conjure (1)
- # data-science (1)
- # datomic (21)
- # emacs (6)
- # events (3)
- # figwheel-main (1)
- # gratitude (13)
- # holy-lambda (11)
- # joyride (6)
- # klipse (3)
- # malli (14)
- # missionary (26)
- # nbb (31)
- # omni-trace (2)
- # pathom (3)
- # reagent (1)
- # reitit (1)
- # releases (1)
- # shadow-cljs (24)
- # sql (27)
- # tools-deps (4)
- # vim (21)
Hello, is there a way to get the transaction data (db-before, db-after, tx-data, etc) as when a given entity was last transacted in the database?
To get the database values: https://docs.datomic.com/client-api/datomic.client.api.html#var-as-of
You can query for the transactions associated with a particular entity and get each transaction instant.
Find the "given entity was last transacted in the database" Well, an entity has many attributes. Each attribute has its last transaction. For now, we will ignore the attributes and get the "newer one"
'[:find (max ?tx)
:in $ ?e
:where
[?e _ _ ?tx]]
Now we can use (d/as-of db tx)
, as @U06FTAZV3 said, to get the :db-after
To get :db-before
is a little tricky: (d/as-of db (dec tx))
The :tempids
values is impossible to "recreate"
The tx-data
value is tricky too:
'[:find ?e ?a ?v ?tx ?op
:in $ ?tx
:where
[?a :db/ident]
[?e ?a ?v ?tx ?op]]
Where $
is the db-after
I'm almost certain the answer to this is going to be no, but is there a version of datomic that is embeddable? If I was writing an application that was deployed to end-users for example? Is there some flavour of datomic that I can bundle into a dmg? I have an application that I've been writing that needs to run both in the cloud and as a local instance. I've been handling the local version via datascript, but now that requirements have shifted, I'm wondering if swapping to datomic makes sense. If I do end up doing that, it would be nice to be able only have to worry about one type of db.
Hmm, it doesn't say anything about embedding, so not sure if that's an ok or not... https://www.datomic.com/datomic-free-edition-license.html
Hmm, ok, what about dev-local, I can't seem to find the license for that, I'm assuming it's a no by default, but would be good to check.
Yea, it would be good if someone from cognitect can answer this 😃... If the response is a no, that's fine. Just want some clarity 😃...
Hmm, ok, this thread[0] is a little concerning, on the one hand it seems like what you're suggesting with datomic free may be acceptable behaviour, Joe[1] says we need something to include as a dependency for our libs
and Marshall doesn't tell him that he's not allowed to do that. So this is perhaps viable.
On the other hand, it seems like there's no further movement on this, so if I proceed here I'll have to accept some divergence between my embedded and cloud / ions versions, which is frustrating.
It may be worthwhile seeing if datascript may be the answer to the local embedded approach and then see how much api difference exists between it and cloud / ions.
Alternatively datascript written straight to s3 or dynamodb may also be viable.
Thanks for the suggestion @U09R86PA4 =)...
• [0]: https://forum.datomic.com/t/datomic-free-being-out-phased/1211/9
• [1]: https://forum.datomic.com/t/datomic-free-being-out-phased/1211/7