Skip to content

Instantly share code, notes, and snippets.

@rodolfo42
Created May 19, 2023 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodolfo42/60520473dfdaedb77c9de82db00ea87d to your computer and use it in GitHub Desktop.
Save rodolfo42/60520473dfdaedb77c9de82db00ea87d to your computer and use it in GitHub Desktop.
Pull datomic data by namespace with tx-time
(ns data
(:require [datomic.client.api :as datomic]))
(def client
(datomic/client {:db-name ""
:system ""
:server-type :cloud
:region ""
:endpoint ""}))
(def conn (datomic/connect client {:db-name ""}))
(def ids
[:customer/id :account/id]
(def where
(vector (cons 'or (map (fn [attr] ['?e attr '_ '?tx-time]) ids))))
(def items
(datomic/qseq {:find '[(pull ?e [*]) ?tx-time]
:keys '[entity tx-time]
:in '[$]
:where where}
(datomic/db conn)))
(comment
; use (take 10 items) to get a sample
(def tables
(->> items (group-by (fn [{:keys [entity]}] (namespace (first (filter (set ids) (set (keys entity))))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment