Created
May 19, 2023 17:30
-
-
Save rodolfo42/60520473dfdaedb77c9de82db00ea87d to your computer and use it in GitHub Desktop.
Pull datomic data by namespace with tx-time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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