Hi there.
I was testing what error I would get when I hit the datomic cloud string limit (4096 chars) when I was surprised to find that transacting strings larger than 4096 characters does not result in an error.
Is the Datomic cloud string size limit a soft limit? If so what other problems could I run into by storing strings larger than 4096 characters?
Here’s a sample of the code I’m running
(ns user
(:require
[datomic.client.api :as d]))
(def db-name "test")
(def get-client
"Return a shared client. Set datomic/ion/starter/config.edn resource
before calling this function."
#(d/client {:server-type :ion
:region "us-west-2"
:system "<system>"
:endpoint "<endpoint>"
:proxy-port 8182}))
(defn get-conn
"Get shared connection."
[]
(d/connect (get-client) {:db-name db-name}))
(defn get-db
"Returns current db value from shared connection."
[]
(d/db (get-conn)))
(def schema
[{:db/ident :string
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}])
(comment
(d/create-database (get-client) {:db-name db-name})
(d/transact (get-conn) {:tx-data schema})
;; test string limit
(let [s (apply str (repeat 10000 "a"))
tx-report (d/transact (get-conn)
{:tx-data [{:db/id "tempid"
:string s}]})
id (get-in tx-report [:tempids "tempid"])
stored-s (:string (d/pull (get-db) '[*] id))]
(println "s length in: " (count s))
(println "s length out: " (count stored-s))
(println "equal? " (= s stored-s)))
;; =>
;; s length in: 10000
;; s length out: 10000
;; equal? true