This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-11
Channels
- # aws (3)
- # babashka (67)
- # beginners (284)
- # calva (19)
- # cider (12)
- # cljdoc (9)
- # clojure (111)
- # clojure-austin (4)
- # clojure-europe (34)
- # clojure-france (12)
- # clojure-greece (2)
- # clojure-nl (14)
- # clojure-taiwan (2)
- # clojure-uk (11)
- # clojurescript (34)
- # community-development (2)
- # conjure (8)
- # datomic (15)
- # events (3)
- # fulcro (12)
- # jobs (3)
- # leiningen (4)
- # malli (3)
- # meander (11)
- # mount (2)
- # off-topic (29)
- # pathom (11)
- # re-frame (31)
- # reagent (19)
- # remote-jobs (3)
- # reveal (8)
- # rewrite-clj (1)
- # sci (1)
- # shadow-cljs (8)
- # spacemacs (4)
- # sql (1)
- # startup-in-a-month (2)
- # tools-deps (2)
- # vim (7)
- # xtdb (6)
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
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?
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
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
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?basically if you want to connect to free or dev over tcp, you now need to set a password.
Thank you @U09R86PA4