Data export / import

Hi, we want to change our production Datomic Cloud system name. Since the only way is to create a new system, we are exploring ways to transfer data from the ugly-name system to our newly cool-named system.

Our work plan is:

  1. Export data to EDN files from the old system
  2. Run transactions with data taken from the EDN files.
  3. Confirm that all data is migrated (using simple unit tests)

Can you recommend any best practices to make this migration smooth?

1 Like

Any reply to this? I am also trying to “export” my transactions into EDN. Presumably, this can be accomplished with a Datomic query but I can’t find documentation how.

@yesyes are you trying to migrate a Datomic system?

To directly answer your question you can query the tx-data of your transaction from the log using tx-range. Log API | Datomic Here is a quick example taken from the Day of Datomic Cloud Example log.clj:

=> #:db{:txInstant #inst"1983-01-01T00:00:00.000-00:00"}
(-> (d/tx-range conn {:start tx-id :end (inc tx-id)})
    first :data)
[#datom[92358976733261 74 "2nd" 13194139533320 true]
 #datom[92358976733261 74 "Elm" 13194139533320 false]
 #datom[92358976733260 74 "Broadway" 13194139533320 true]
 #datom[92358976733260 74 "1st" 13194139533320 false]
 #datom[13194139533320 50 #inst"1983-01-01T00:00:00.000-00:00" 13194139533320 true]]

But if you are looking at doing this because you want to move the DB and migrate as with the original poster I strongly recommend looking at Caribou, a community made tool for migrating Datomic Cloud DBs. I’d be happy to share other approaches we have used in the past for migration and advice for writing your own tool as needed.