Fork me on GitHub
#datomic
<
2018-04-04
>
brunobraga03:04:08

does anyone know how I can update an attribute inside an entity, datomic keeps creating a new entity, which I believe is expected based on what it proposes, however I need to change a string value inside an entity from "todo" to "doing". Is it not the datomic way to look at it?

cjohansen06:04:49

@brnbraga95 (d/transact conn [[:db/add entity-id :your/attribute "doing"]])

cjohansen06:04:24

or the slightly more paranoid (d/transact conn [[:db.fn/cas entity-id :your/attribute "todo" "doing"]])

cjohansen06:04:24

entity-id can be the actual entity id, e.g. (:db/id entity), or a unique reference. based on what you say (“keeps creating a new entity”) I suspect you are using a ref that is not unique?

igrishaev08:04:42

Does anybody know how can I connect to remote transactor? My URL looks like

"datomic:"
But I could not google for where to put transactor’s host and port.

igrishaev08:04:29

The idea behind that is, before I had a single node with everything installed on it at once: Clojure app, Postgres and Transactor. Now I move them across several nodes. I’d like to have several Clojure app instances that connect to a node that has Postgres + Datomic transactor. Still, my app tries to communicate with local transactor by localhost + 4334.

igrishaev09:04:05

Solved: the solution was to declare a global IP in transactor properties rather then localhost. Other nodes discover it from the db.

marshall12:04:37

peers connect to storage first, read the transactor location, then connect to the transactor

Ben Hammond13:04:19

is there of list of :db/error values in the datomic docs? I am aware of - :db.error/transactor-unavailable - :db.error/transaction-timeout are there any others (that might be remediable)

Ben Hammond13:04:51

is it reasonable to assume that #{:db.error/transaction-timeout :db.error/transactor-unavailable} are the only two error types that are worth retrying ?

brett14:04:03

I have a syntax question. This is working:

(d/q '[:find (pull ?e [*])
       :where [?e :team/id]] db)
This is not, and is throwing Exception
(d/q '[:find [(pull ?e [*]) ...]
       :where [?e :team/id]] db)
Exception
ExceptionInfo Only find-rel elements are allowed in client find-spec
I’m using datomic-pro-0.9.5661

brett14:04:04

All I changed is the binding form. I see it in both links you sent.

marshall14:04:01

The client only supports the find-rel form. You can use the other binding forms for inputs, but not in the find specification

brett14:04:53

I see it now. Hmm, that’s unfortunate.

eoliphant15:04:09

hi , is there a convinient way to copy a database (in the same storage)? in reading the docs for restore-db it seems that that is not possible with that tool at least