XTDB is a general-purpose bitemporal database for SQL, Datalog & graph queries.
The chinook data represents a digital media store including tracks, albums, artists, playlists and genres. The repository does not include all entities exposed by the chinook database but only a portion. The exposed entity relationship is shown in the following diagram.
For the following commands to work, you need to have the Clojure CLI installed.
The repository has essentially three namespaces. One for exporting the data from the sqlite database to general Clojure map format. You can invoke this via
$ clj -X xtdb-chinook.export/write-entities :path \"entities.edn\"
which will extract the entities into an edn file of your choice. In case you want to ingest the data yourself into XT.
Beware these entities are kept in a rather general format so you they could potentially be ingested in other datalog
backed db's. You would need to remap the db/id
before ingesting into xt.
(->> (read-string (slurp "entities.edn"))
(map #(clojure.set/rename-keys % {:db/id :xt/id})))
The second namespace ingests the extracted data into a fresh xt node.
$ clj -X xtdb-chinook.ingest/ingest
The same as the chinook repository.