This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-19
Channels
- # adventofcode (82)
- # beginners (70)
- # boot (34)
- # boot-dev (13)
- # cider (45)
- # clara (4)
- # cljs-dev (3)
- # cljsrn (2)
- # clojure (91)
- # clojure-art (8)
- # clojure-czech (1)
- # clojure-dusseldorf (3)
- # clojure-france (11)
- # clojure-germany (1)
- # clojure-greece (39)
- # clojure-hamburg (1)
- # clojure-italy (24)
- # clojure-norway (2)
- # clojure-spec (7)
- # clojure-uk (31)
- # clojurescript (56)
- # core-async (7)
- # cursive (8)
- # data-science (10)
- # datomic (41)
- # duct (7)
- # emacs (1)
- # events (1)
- # fulcro (83)
- # graphql (6)
- # klipse (1)
- # leiningen (28)
- # lumo (67)
- # off-topic (14)
- # om (9)
- # onyx (3)
- # perun (4)
- # re-frame (22)
- # reagent (11)
- # ring-swagger (2)
- # rum (1)
- # specter (46)
- # sql (13)
- # uncomplicate (17)
- # unrepl (114)
Good evening. We are using the with
to allow users to perform some speculative transactions so that they can see how their changes affect other things before deciding whether or not to actually commit the changes. We have captured db-after
and tempids
from the results of the with statement. We can use the resolve-tempid
function to determine the id that was assigned during the with
, but has anyone found a method to go the other direction? Meaning… we would like to map through the tempids returned and convert them back to the original temp-id that was sent in the tx for the with.
:tempids
is just a map. Resolve-tempid is a convenience to construct numeric tempids (the negative numbers) from the tempid records created by d/tempid
. You can use d/part
, d/tx->t
, d/ident and some bit twiddling to get an equivalent tempid record from a negative long
You can use d/entid-at
and d/entid
to make the negative long from the tempid record yourself
Thanks @U09R86PA4. I will give this a try.
im going through the peer getting started guide http://docs.datomic.com/peer-getting-started.html and I keep getting ":db.error/entity-missing-db-id Missing :db/id" when attempting to transact the schema. Im confused as to why this fails.
Are you sure you are transacting (transact conn [{:db/id ...}])
not (transact conn {:db/id ...})
?
yes i am sure. I am providing a vector of maps. I've copied and pasted from the site to make sure it wasnt me. I am not using the mem storage protocol and have moved to the local dev setup and am trying to run through some of the examples again. Im not sure if that has something to do with it
datomic-pro-0.9.565
@(d/transact conn [{:db/ident :movie/title
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The title of the movie"}])
I didnt have any problems with mem
I suppose but I dont know for sure. I downloaded the zip and I am running everything from the ./datomic-extracted/bin directory
user=> (require '[datomic.api :as d])
nil
user=> (def db-uri "datomic:)
#'user/db-uri
user=> (d/create-database db-uri)
true
user=> (def conn (d/connect db-uri))
#'user/conn
(def movie-schema [{:db/ident :movie/title
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The title of the movie"}
{:db/ident :movie/genre
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The genre of the movie"}
{:db/ident :movie/release-year
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one
:db/doc "The year the movie was released in theaters"}])
#'user/movie-schema
user=> @(d/transact conn movie-schema)
{:db-before [email protected], :db-after [email protected], :tx-data [#datom[13194139534312 50 #inst "2017-12-19T21:03:39.346-00:00" 13194139534312 true] #datom[63 10 :movie/title 13194139534312 true] #datom[63 40 23 13194139534312 true] #datom[63 41 35 13194139534312 true] #datom[63 62 "The title of the movie" 13194139534312 true] #datom[64 10 :movie/genre 13194139534312 true] #datom[64 40 23 13194139534312 true] #datom[64 41 35 13194139534312 true] #datom[64 62 "The genre of the movie" 13194139534312 true] #datom[65 10 :movie/release-year 13194139534312 true] #datom[65 40 22 13194139534312 true] #datom[65 41 35 13194139534312 true] #datom[65 62 "The year the movie was released in theaters" 13194139534312 true] #datom[0 13 65 13194139534312 true] #datom[0 13 64 13194139534312 true] #datom[0 13 63 13194139534312 true]], :tempids {-9223301668109598143 63, -9223301668109598142 64, -9223301668109598141 65}}
user=>
@U05120CBV I tried that and I still get the ":db.error/entity-missing-db-id Missing :db/id" error. Maybe I'm not running the transactor and peer server correctly?
bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d test,datomic:
bin/transactor ./dev-transactor-template.properties
the only thing i added to the template is the license
@U09R86PA4 is correct. no peer server required for using the peer itself
@U05120CBV i have started the transactor. even the basic
@(d/transact conn [{:db/doc "Hello world"}])
gives me IllegalArgumentExceptionInfo :db.error/entity-missing-db-id Missing :db/id datomic.error/arg (error.clj:57)
datomic-pro-0.9.5656
sent the email
this is in my project outside of the directory not using the bin/repl
(require '[datomic.api :as d])
it's pretty clear im missing something fundamental so i'm going to start over. I have an application written in clojure with a postgres db. I wanted to learn datomic so I thought it would be cool to replace postgres with datomic in this simple app. So a new question (starting from scratch): I want to have a local datomic database (strictly development) on my machine to read and write from within my clojure code. Is there a link or tutorial that would help me achieve this? What components of datomic would I need to run? And what would I use to make queries and transactions to datomic from clojure?