Fork me on GitHub
#datomic
<
2021-01-20
>
Christos17:01:49

Hello, I have created a function which makes a query to datomic dev-local. When I call it as a normal function the query returns data. When I call it as a transaction function on the same db the query returns nothing. Any ideas?! Many thanks

favila18:01:46

Confirm, your fn signature looks like (defn fn-name [db arg1 arg2 ,,,]) , you call it “normally” like (fn-name db arg1 arg2 ,,,) and you “call” it in a tx like [,,, ['namespace/fn-name arg1 arg2] ,,,] (note fully qualified, implicit db arg omitted)

Christos19:01:06

Exactly Francis, that is what I do and with exactly the same arguments.

favila19:01:52

How do you know the results are different?

Christos19:01:24

I throw an exception in the transaction and I include in the message the result of the query. In the case of the transaction it is an empty vector.

Christos19:01:10

It does not find what the non-transaction related function call finds.

favila19:01:42

And you are sure they are the same db?

Christos19:01:35

In the non-trans version I use (d/db conn) using the same conn as the one in the trans version. So I guess they are the same.

Christos19:01:02

And I dont change anything in between