Datomic Auto Schemas
summary
Automatic generation of Datomic schemas from arbitrary JSON by scanning incoming documents, inferring datatypes, and asserting attribute defs before data ingest; arrays become linked-list cons cells to preserve order, nulls map to a singleton ref and conflicting types create stub attribute entities (renamed typed variants) so round-trip JSON stays lossless. Implementation uses Clojure transducers, a DB wrapper that caches attribute metadata, and a start-tx/commit-tx long-running transactions replay that commits speculative work. Works in production inside the Naga rule engine; code lives in the Naga repo and is practical for heterogeneous JSON.
AI-written summary · about
chapters (24)
- 0:00Intro
- 0:21Case Study from Naga
- 2:19JSON Transport
- 5:54JSON Tree
- 6:25JSON Graph
- 7:03Datomic Entities
- 9:27Datomic Types
- 10:25Simple conversion
- 13:50Null Entity
- 14:33Annotated Attributes
- 15:09Arrays
- 16:57Array Structure
- 18:48Nested Objects
- 19:27Nested Structure
- 21:14Example JSON
- 23:17Existing Properties
- 23:54General Procedure
- 25:19API Wrapping
- 26:03Immutable Records
- 26:59Query Rewriting
- 28:03Example Rewrite
- 29:08Transactions
- 30:10Read/Write Transaction
- 32:28JSON Export








