Fork me on GitHub
#datomic
<
2021-01-11
>
jacklombard03:01:39

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:)
  (def db-uri "datomic:)
  (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

jacklombard03:01:32

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?

cjmurphy03:01:21

The db you are using stale. After doing any transacts a new db needs to be grabbed.

✔️ 4
oxalorg (Mitesh)06:01:38

^^ Doing something like this: (defn db [] (d/db conn)) and then replacing calls to db with (db) should solve this

Lennart Buit08:01:36

You also get a db-after value from d/transact !

jcf11:01:28

Best practice is to use the :db-after from your transact call. https://docs.datomic.com/on-prem/best-practices.html#use-dbafter

PB16:01:17

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?

favila16:01:57

(that’s a really old datomic you’re upgrading from if this is indeed your issue…)

favila16:01:07

basically if you want to connect to free or dev over tcp, you now need to set a password.

JAtkins21:01:53

Is there a way to retrieve a datomic ion build id (git sha) from the running env?

tatut05:01:14

I did the same, but then you can’t use :rev but have to have :uname instead

tatut05:01:19

as the git tree isn’t clean

JAtkins15:01:21

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