Fork me on GitHub
#datomic
<
2022-01-07
>
helios10:01:12

given a entity - attribute pair, is there a way to retrieve the tx that added the attribute without doing a query on history db?

favila13:01:13

I’m assuming by “added the attribute” you mean added any datom looks like [?e ?attr _ ?tx true] and you want the ?tx , not that you want the tx that added the attribute (schema) itself.

favila13:01:48

If you know the datom is “current” (i.e. is asserted on your “now” db) you don’t need the history db.

favila13:01:13

:where [?e ?attr _ ?tx true] ?tx is the transaction that asserted the datom

favila13:01:41

otherwise you need the history db, and you need to decide what it means if the attr is asserted+retracted multiple times

helios14:01:40

@U09R86PA4 thanks, you're right i wasn't precise with 'added'. My intention is more like: except from a datalog query, is there any other way to retrieve the last transaction on a given entity?

helios14:01:22

was looking something like (d/tx e attr) in the entity api

helios15:01:12

My point is that i'm storing in an attribute some value which changes over time, and i'd like to see the "when was it last updated" (the txInstant). I know how to do it easily with a datalog query

(d/q
       '[:find ?tx ?attr ?val ?added
         :in $ ?e
         :where
         [?e ?attr ?val ?tx ?added]]
       (d/history my-db)
       my-eid)

FiVo11:01:31

I am trying to connect to datomic and getting activemq-version.properties is not available as an error. The stacktrace goes through the connector and the artemis client. Any ideas?

jaret14:01:04

What version of Datomic and how are you connecting?

FiVo17:01:51

com.datomic/datomic-pro "1.0.6202"

FiVo17:01:35

datomic on-prem with in-process peer library

FiVo17:01:45

the transactor runs remotely

jaret13:01:08

So I'd recommend running the latest datomic-pro (http://my.datomic.com/downloads) and ensure you are using an LTS version of java (8,11,17). Then let me know if you still see the error.

jaret15:01:12

I have heard anecdotally that this problem might be because you are using Java 18. I have not yet tested today, but wanted to share that this might be a breaking change that we will have to account for to support Java 18.