Fork me on GitHub
#datomic
<
2021-05-15
>
Pragyan Tripathi06:05:48

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.

benoit13:05:27

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.

souenzzo20:05:22

on datomic on-prem, you can use bytes + nippy

Pragyan Tripathi11:05:22

I figured out a way to use refs in my schema to solve my problem... Thanks 🙂

Yarin Kessler21:05:25

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)

Alex Miller (Clojure team)22:05:13

Is that capital ?Track in there? Seems like that should be lowercase to match the others

🙌 2
Yarin Kessler22:05:13

YES! Thanks Alex- I never would have spotted that!

Alex Miller (Clojure team)22:05:14

I dropped a note in our internal support channel to fix the docs, sorry about that

Alex Miller (Clojure team)22:05:17

Might be creating an unintended free variable