Joining across databases in Datomic Cloud

We’ve just recently encountered our first use-case for joining across independent databases in Datomic Cloud. I’ve found it difficult to find an authoritative answer on whether or not this is supported in Cloud, with most relevant examples illustrating different temporal versions of the same database, e.g. querying across d/since and d/db from the same connection.

I’ve seen the Filtering and multi-database queries thread, but still seem to have a hard time deducing a definitive answer on whether or not a join across independent databases can be expressed in Datomic Cloud.

Is querying across independent databases as defined by different :db-names possible in Datomic Cloud? E.g.:

(def client (d/client ,,,))

(def conn1 (d/connect client {:db-name "db1"}))
(def conn2 (d/connect client {:db-name "db2"}))

(d/q '[:find ,,,
       :in $1 $2 ,,,
       [$1 ,,,]
       [$2 ,,,] ,,,]
     (d/db conn1)
     (d/db conn2)

Edit: To be clear, I have tried various configurations of the above at the REPL, and receive an error for each of the things I’ve attempted:

Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
Query db arg does not match connection

I’m trying to determine if I’m the problem, as is often the case, or if this sort of query is unsupported.

I will certainly be bummed if there’s no natural way to do this kind of thing in Cloud, as this represents such a uniquely powerful capability. The naive workaround—i.e. separating the queries and combining results after the fact—doesn’t suggest any concrete detriment, especially in this particular case, but I do worry that walking this path may cause my inner R.H. to shed a single tear.

Hoping for good news! And I apologize if I’ve missed a relevant docs section or thread on this topic.


Currently in Cloud, you can join across the same database at different points in time, but not across different DBs.

1 Like

Hey Joe!

Really appreciate the quick and definitive response, especially on the weekend.

Have a great rest of the weekend all!

1 Like