-
keystore data, w/o the tradeoffs of other nosql databases
-
ACID tx, joins, datalog, simple schema
-
"Facts dont change when you incorporate time"
- SQL db in past, CRUD triggers, history tables
The promise of tracking historical data for free. For something like AG WIFE, could be useful for saying "get settings (as of last week)".
[entity id, attribute, value, tx time]
[42, :owner/name, "jeb", #inst "2013-11-15T17:06:24.182-00:00"]
[{:db/id #db/id[:db.part/db]
:db/ident :owner/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "An owner's name"
:db.install/_attribute :db.part/db}]
A bunch of datoms! (+ Indeces)
- Prolog subset (forked 1977)
- Declarative, logic programming
- Uses data (maps, sets), rather than string-based DSL
- Datalog > SQL ?
[:find ?name
:where [_ :owner/name ?name]]
[:find ?eid
:in $ ?owner-name
:where [?eid :owner/name ?owner-name]]
(require '[datomic.api :as d])
(def conn "datomic:mem://pets")
;; Current time
(d/q '[:find ?owner-name
:where [_ :owner/name ?owner-name]]
(d/db conn)))
;; 12-01-2013
(d/q '[:find ?owner-name
:where [_ :owner/name ?owner-name]]
(d/as-of (d/db conn) (java.util.Date. 113 11 1)))
- Interface IDataSource (5 fn)
- vs SQLite
- 4-6 hours of learning time
- familiarity w/ Clojure data literals
- simplicity of queries
- Unit testing (in-mem storage out of the box)
- Small mismatch between programming & data models ??