Closed jethron closed 8 months ago
Thanks @jethron, this should be easy enough to enable in the macro itself (just adding a database option and passing it to the relation call), it'll take a while to propagate through to our other packages though as we'll have to make an update and release for all calls of it.
How common do you think it is to have your atomic data in one database and want to write your models into another?
it'll take a while to propagate through to our other packages though as we'll have to make an update and release for all calls of it.
Yeah, hence not just making a PR. :sweat_smile:
How common do you think it is to have your atomic data in one database and want to write your models into another?
It's taken this long to be an issue for a customer, so probably not very common?
This customer is using them as logical separation, but I think that's because historically they had a dev pipeline going to this second database and the *_dev
name of it made it logical to use for dbt development, too. In prod it will likely end up that snowplow__database
will === the target database.
Thanks, I've got a ticket next sprint hopefully to add this - should at least be able to do utils and unified and then just roll the others out over a longer period.
If it is critical, you could always overwrite the macro with your own version in the meantime that considers that variable if it exists. Should pretty much be a flat copy and just swap out this line
{% set relation = api.Relation.create(database = var('snowplow__database', target.database), schema = schema, identifier = identifier) %}
I actually forgot that this is now mostly handled directly in the base macors now, so except for models where we explicitly use this (I think we do in ecom, maybe nothing else?) this change would actually be immediately available in all packages.
Describe the bug
In the Snowplow data models, you can configure
snowplow__database
to specify a database that differs from your target. If you/the models use the Postgres/Redshiftget_sde_or_context
macro, that database isn't passed through and respected, and the Relation created assumes the target database instead.Steps to reproduce
snowplow__database
to use a different databaseExpected results
Macros adhere to the configuration and access tables from the configured other database
Actual results
Screenshots and log output
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using: Windows
The output of
python --version
: 3.xAre you interested in contributing towards the fix?