Use data from two databases in one question


#1

Is it possible to source data from two different databases both connected to Metabase and use it in the same question?


#2

No; when dealing with multiple databases, data should be consolidated within a data warehouse for many proven design choices, but ignoring that, most query linguistics are designed to deal with only one server at a time, and the “questions” in Metabase are just nicely formatted queries with a few differences in design.

How do you have your servers set up?


#3

We do not currently support joining across multiple databases.

Like @Mike says, it’s generally a good idea to bring any data you want to query together into a single data warehouse. We strongly recommend you deal with the pain of bringing together data “On Write” vs “On Read” in terms of analytics queries.

If you absolutely must kludge something together, we’ve seen people use PostgreSQL foreign data wrappers and do joins across those. Just be aware that it’s a particularly expensive form of technical debt.


#4

postgres FDW is an option, but as sameer mentioned, its expensive from technical debt, if its simple lookup then its OK, for large joins its really better to avoid it

oracle db-links work similar way and are reasonably simple to tune with hints and easier to setup and maintain than postgres FDW (though I feel postgres FDW are more flexible for non-ODBC source)

you can also look at “virtual data warehouse” solutions like Denodo (did not try it), their express version is free http://www.denodo.com/en/denodo-platform/denodo-express - when I talked to them years ago, their solution was based on postgres and connection using plain postgres driver, not sure if its still the case. If it is, it could possibly work with metabase


#5

Depending on what you want to exactly do (your question does not speak about JOIN) you can do what you intend to do by specifying properly your path to the tables across the different databases : if you use microsoft sql server, you will use the following syntaxe

database1.dbo.tableN

instead of

tableN

Had to perform a union of queries on a former table and new replacing table and it worked perfectly.

regards


#6

Is there any plan to put this feature into RoadMap?


#7

@dibyendu.roy
There’s a feature request open - go and vote by clicking the :+1: