Discussion:
Pulling last transaction of as-of'ed database
Eugene Trifuntov
2017-04-06 12:50:47 UTC
Permalink
Hello.

I am playing with datomic time filters and faced some behaviour I can't
understand.
Here is the code:


(let [inst #inst "2016-11-09T00:00:00.000-00:00"
db (d/db conn)
ao-db (d/as-of db inst)
tx (d/t->tx (d/basis-t ao-db))]
(d/pull ao-db '[*] tx))

I would expect that `tx` will be the most recent transaction in `ao-db` but
when I do d/pull on it I receive {:db/id 13196381607868} as if there is no
such transaction at all.
Even more strange is that if I'm pulling original db and not as-of'ed I am
getting following map: {:db/id 13196381607868, :db/txInstant #inst
"2017-04-06T11:32:01.712-00:00"} as if the transaction was done today and
not 2016-11-09 :(


So what do I get wrong about datomic's time filters?
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ben Hammond
2017-04-06 16:38:33 UTC
Permalink
*d/as-of *is just a filter on top of the database; it does NOT affect the
basis-t of the database (which was sampled when d/db was called)

If you want to retrieve the time on a *d/as-of* filtered database you want
*d/as-of-t*
Post by Eugene Trifuntov
Hello.
I am playing with datomic time filters and faced some behaviour I can't
understand.
(let [inst #inst "2016-11-09T00:00:00.000-00:00"
db (d/db conn)
ao-db (d/as-of db inst)
tx (d/t->tx (d/basis-t ao-db))]
(d/pull ao-db '[*] tx))
I would expect that `tx` will be the most recent transaction in `ao-db`
but when I do d/pull on it I receive {:db/id 13196381607868} as if there is
no such transaction at all.
Even more strange is that if I'm pulling original db and not as-of'ed I am
getting following map: {:db/id 13196381607868, :db/txInstant #inst
"2017-04-06T11:32:01.712-00:00"} as if the transaction was done today and
not 2016-11-09 :(
So what do I get wrong about datomic's time filters?
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...