datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
Christos 2021-01-20T17:23:49.040600Z

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

jaret 2021-01-20T17:45:20.041200Z

Cognitect dev-tools version 0.9.58 now available. https://forum.datomic.com/t/cognitect-dev-tools-version-0-9-58-now-available/1751

👍 3
favila 2021-01-20T18:38:46.041400Z

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)

Christos 2021-01-20T19:41:06.041800Z

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

favila 2021-01-20T19:43:52.042700Z

How do you know the results are different?

Christos 2021-01-20T19:46:24.042900Z

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.

Christos 2021-01-20T19:47:10.043100Z

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

favila 2021-01-20T19:47:42.043700Z

And you are sure they are the same db?

Christos 2021-01-20T19:49:35.044700Z

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.

Christos 2021-01-20T19:50:02.044900Z

And I dont change anything in between