-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CT-2149] [Feature] Add the possibility to map a single dbt entity to multiple databases #7021
Comments
Thanks for reaching out @jochemvandooren ! Historically, dbt has held the philosophy of "one model, one output (table)", and we're inclined to stick with it. Reading about your use-case, it seems like one key thing you're after is being able to see all the different databases in a single catalog. Let's pretend we could wave a magic wand and be able to merge the output of two different executions of Would that solve your problem? Or would there be other key design criteria that would still be unaddressed in that scenario? |
Hi @dbeatty10, thanks for your quick response! You are absolutely right that the problem is not being able to see all different databases in a single catalog. This magic wand:magic_wand: sounds great and indeed would fix the issue! The This is also something I already looked into myself, but turned out to be not too straightforward at this point in time. With the current structure of But being able to merge the output of different executions of |
Hey @dbeatty10, good to see you across multiple repos ;) I'm working with @jochemvandooren on the same project, and to add to his perspective:
Would that make sense? Thank you! |
@matthieucan good to see you again too! Yep, we would want to preserve all relationships (like models and associated tests, etc). I think we'd also want it to act similar to a I don't know what the Project and Database tabs would end up looking like (or how exactly we'd want them to look). But what you laid out looks reasonable. In terms of trying out a JSON merge, I'm wondering if Would you be willing to experiment with one or both of the following and see what they do? (Of course you'll want to use the most simple project possible for any experiments.) |
Thanks for the quick response and my apologies for the late reply! I finally found some time to do some experiments with You are right that it should act like a output1.json {
"nodes": {
"model1": {
"database": "database1",
"fqn": [
"dwh",
"foobar",
"model1"
],
"unique_id": "model.dwh.model1",
"name": "model1"
}
}
} output2.json {
"nodes": {
"model1": {
"database": "database2",
"fqn": [
"dwh",
"foobar",
"model1"
],
"unique_id": "model.dwh.model1",
"name": "model1"
}
}
} When combining the two outputs, the result should look something like: merged.json {
"nodes": {
"model1_A": {
"database": "database2",
"fqn": [
"dwh",
"foobar",
"model1_A"
],
"unique_id": "model.dwh.model1_A",
"name": "model1"
},
"model1_B": {
"database": "database2",
"fqn": [
"dwh",
"foobar",
"model1_B"
],
"unique_id": "model.dwh.model1_B",
"name": "model1"
}
}
} As you can see, the keys of the models inside I was not able to figure out if this is possible with These experiments were done with a very basic dbt project, only one model and no tests associated with them. So reality might be more complex than my examples! |
I think there's overlap here with the inheritance conversation. #6527 There may be, at least, cross-dialect use cases here the request to add column level |
Circling back to this... The cruxAs you know, the way
In contrast, this issue is proposing a web experience that is database-centric:
CardinalityWhen restricted to a single But this issue describes multiple independent executions of In the current paradigm for In order to generate a single website, we'd need to invert the paradigm completely and turn everything inside-out. The SummaryWe don't have appetite for those changes to the docs website at this time, so I'm going to close this issue as But an alternative dbt-docs experience (like https://github.com/PicnicSupermarket/dbt-docs) could totally take multiple |
Thanks @dbeatty10 for your explanation! I understand that making this work would require a big overhaul, which is probably not worth it. |
Is this your first time submitting a feature request?
Describe the feature
Currently it is impossible to map a single dbt entity to multiple databases. Add the possibility to enable a single dbt entity on multiple databases.
Consider a setup where a table can exist in several databases. The tables, spread over the multiple databases, are exactly the same except for the data inside the table.
There is no way to have a single model/source enabled in multiple databases, during a single run. It is however possible to run
dbt run
multiple times (for each database), but fordbt docs generate
it is impossible to get the the expected output since multiple versions of catalog files are generated and only one version can be served.Describe alternatives you've considered
dbt run
multiple times; not a solution fordbt docs generate
.sources
level:Who will this benefit?
Anyone who wants to have a single dbt entity mapped to multiple databases in a single dbt project.
Are you interested in contributing this feature?
I would be interested.
Anything else?
We have a setup where we are deploying a dbt project to multiple databases, as we want these structures to exist there, which are then sourced with different data. This allows us to have segmented databases for different deployments, which is how our business is structured. However, we would like to have a unique catalog to represent the multiple databases, which would mean a single dbt entity mapped to multiple database relationships, one per database.
The text was updated successfully, but these errors were encountered: