Hello Guys. Is there a correct way to store raw edn data in datomic? Only way I could figure out is stringify the edn and parse it when reading.
You can't store Clojure values as-is in Datomic. You have to represent them using the Datomic schema. https://docs.datomic.com/cloud/schema/schema-reference.html#db-valuetype
You can always store an EDN string using the :db.type/string
type but it is limited to 4096 characters according to the docs (same link).
Also, keep in mind that you won't be able to query against the values inside your EDN string.
on datomic on-prem, you can use bytes + nippy
I figured out a way to use refs in my schema to solve my problem... Thanks 🙂
The following query was taken straight from Datomic docs (https://docs.datomic.com/cloud/query/query-data-reference.html#variables), but when I run it it goes into an infinite loop of continuous data output, forcing my to terminate my REPL. Any idea why?
(d/q '[:find ?name ?duration
:where [?e :artist/name "The Beatles"]
[?track :track/artists ?e]
[?track :track/name ?name]
[?Track :track/duration ?duration]]
db)
(Running this against mbrainz (https://docs.datomic.com/cloud/examples.html#datomic-samples) on local-dev instance)Is that capital ?Track in there? Seems like that should be lowercase to match the others
Might be creating an unintended free variable
@ykessler ^^
YES! Thanks Alex- I never would have spotted that!
I dropped a note in our internal support channel to fix the docs, sorry about that