Fork me on GitHub
#datomic
<
2020-10-12
>
joshkh10:10:42

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

vncz15:10:33

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

joshkh16:10:57

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

vncz12:10:03

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

marshall12:10:03

you should use domain identifiers

marshall12:10:36

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

marshall12:10:10

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

vncz13:10:33

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

vncz13:10:58

This is the current schema I am using

vncz13:10:22

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

marshall14:10:26

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

marshall14:10:29

when/if that’s relevant

vncz14:10:26

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

vncz12:10:59

Fair. Thanks.

vncz15:10:23

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

joshkh15:10:58

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?

joshkh15:10:51

(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?

benoit16:10:04

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."

joshkh09:10:29

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

Chicão18:10:46

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ão18:10:28

I deleted folder data from datomic/