Apologies for the beginner question and for the cross post from the beginners channel (was asked to post here). I'm having trouble doing a basic query using the peer library, I have tried both the dev (with the dev transactor running) and mem protocols.
(comment
(def db-uri "datomic:<mem://localhost:4334/indium%22|mem://localhost:4334/indium">)
(def db-uri "datomic:<dev://localhost:4334/indium%22|dev://localhost:4334/indium">)
(d/create-database db-uri)
(def conn (d/connect db-uri))
(def db (d/db 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"}])
(def first-movies [{:movie/title "Explorers"
:movie/genre "adventure/comedy/family"
:movie/release-year 1985}
{:movie/title "Demolition Man"
:movie/genre "action/sci-fi/thriller"
:movie/release-year 1993}
{:movie/title "Johnny Mnemonic"
:movie/genre "cyber-punk/action"
:movie/release-year 1995}
{:movie/title "Toy Story"
:movie/genre "animation/adventure"
:movie/release-year 1995}])
(d/transact conn movie-schema)
(d/transact conn first-movies)
(def all-movies-q '[:find ?e
:where [?m :movie/title ?e]])
(d/q all-movies-q db))
This is the error when I run (d/q all-movies-q db)
Execution error (Exceptions$IllegalArgumentExceptionInfo) at datomic.error/arg (error.clj:79).
:db.error/not-an-entity Unable to resolve entity: :movie/title
Tried derefing the both the movie-schema and first-movies transactions so that it waits for it to (complete?), still the same error. Guessing the movie schema is not being persisted?
You also get a db-after value from d/transact
!
Best practice is to use the :db-after
from your transact call.
https://docs.datomic.com/on-prem/best-practices.html#use-dbafter
The db
you are using stale. After doing any transact
s a new db needs to be grabbed.
^^ Doing something like this: (defn db [] (d/db conn))
and then replacing calls to db
with (db)
should solve this
I have my datomic transactor running from within a docker container. Upon upgrading to 0.9.6024
I am getting the following error:
Execution error (JdbcSQLException) at org.h2.engine.SessionRemote/done (SessionRemote.java:568).
Remote connections to this server are not allowed, see -tcpAllowOthers [90117-171]
I cannot find much about this. Can anybody give me any hints?https://forum.datomic.com/t/important-security-update-0-9-5697/379 ?
(that’s a really old datomic you’re upgrading from if this is indeed your issue…)
basically if you want to connect to free or dev over tcp, you now need to set a password.
Thank you @favila
Is there a way to retrieve a datomic ion build id (git sha) from the running env?
Dunno if this works for you, but I added a job in my build script for ion push that writes the current sha into the resources folder before packing into the jar.
I did the same, but then you can’t use :rev but have to have :uname instead
as the git tree isn’t clean
Wouldn't it be? Ions can only push from clean git trees*, and if you ignore the build repos nothing should change anyway. I used git rev-parse HEAD