Ask questions on the official Q&A site at https://ask.datomic.com!
steveb8n 2020-10-12T09:46:24.444300Z

I have a tree read at the core of my app. It's was tricky to make it perform well and it's still not super fast. I'm using recursive rules. My summary: it's possible but non-trivial

joshkh 2020-10-12T10:07:42.446Z

does Datomic Cloud have a REST API similar to on-prem? https://docs.datomic.com/on-prem/rest.html

vncz 2020-10-12T12:49:03.447Z

Are EntityIDs in Datomic something we can use as "user space" identifiers or shall we use our own?

marshall 2020-10-12T12:51:03.447400Z

you should use domain identifiers

marshall 2020-10-12T12:51:36.448100Z

there are a variety of reasons not to expose entity IDs to your applications layers as user-space identifiers

marshall 2020-10-12T12:52:10.448800Z

if there isn’t a straightforward choice for an identifier in your particular domain, you can always generate a UUID for entities and just use that

vncz 2020-10-12T12:52:59.449Z

Fair. Thanks.

marshall 2020-10-12T12:53:06.449200Z


vncz 2020-10-12T13:43:33.449300Z

Is there a way to get the created id without having to re-query? I can see there is a tempId field but it's empty

vncz 2020-10-12T13:43:58.449700Z

This is the current schema I am using

vncz 2020-10-12T13:53:22.450100Z

Oh ok my mistake, it is not autogenerated, I'm still responsible for generating it

marshall 2020-10-12T14:04:26.450300Z

right, and the :tempids map will return the mapping between actual assigned entity IDs and the tempids you supply

marshall 2020-10-12T14:04:29.450500Z

when/if that’s relevant

vncz 2020-10-12T14:15:26.450700Z

Ok, I guess I'll have to use a regular java.uuid to get my number; was hoping Datomic would handle the ids for me somehow but that ain't a problem

vncz 2020-10-12T15:41:33.450900Z

I am almost sure it does not; you can build one with Java/Clojure that would internally use the client API

vncz 2020-10-12T15:42:23.451500Z

What is the best practice about the schema? Do you usually transact it every time the application starts? Or only when running a "migration"?

joshkh 2020-10-12T15:55:58.454900Z

can i use :db/cas to swap an attribute value for one that is missing to one that is present (and vice versa), or is it only compatible with swapping two "non-nil" values?

joshkh 2020-10-12T15:59:51.455600Z

(d/transact conn {:tx-data [[:db/cas 12345 :reader/nickname nil "joshkh"]]})
entity, attribute, and new-value must be specified
i suspect i'll have to roll out my own transactor function for that?

joshkh 2020-10-13T09:52:29.458800Z

huh, thanks for pointing that out. i thought i tried that... sure enough nil to non-nil works. thanks!

joshkh 2020-10-12T16:04:57.455700Z

i haven't looked through the code, but this NodeJS library claims to be cloud compatible, so perhaps there is an accessible rest API? https://github.com/csm/datomic-client-js

benoit 2020-10-12T16:53:04.456100Z

The old value can be nil (per doc): "You can use nil for the old value to specify that the new value should be asserted only if no value currently exists."

Chicão 2020-10-12T18:10:46.457400Z

Someone can help me? I want to restore my backup but I've got this problem

java.lang.IllegalArgumentException: :restore/collision The name 'db-dev' is already in use by a different database                                                                

Chicão 2020-10-12T18:17:28.457500Z

I deleted folder data from datomic/