Dbt: alias models to change their names in the database

Created on 9 Jan 2018  路  4Comments  路  Source: fishtown-analytics/dbt

This could be useful when paired with custom schemas. For example, there could be a users table in both the snowplow_analytics and product_analytics schemas. Behind these scenes, these models would be named something like snowplow_users.sql and product_users.sql, respectively.

Config would look like:

-- models/snowplow/snowplow_users.sql

{{ config(alias='users', schema='snowplow_analytics') }}

select * from ...

dbt would need to enforce uniqueness between schema + aliased_name

enhancement

Most helpful comment

馃憤 This would be tremendously helpful when migrating to dbt so as to ensure parity with existing data infrastructures that were not built with dbt in mind.

All 4 comments

馃憤 This would be tremendously helpful when migrating to dbt so as to ensure parity with existing data infrastructures that were not built with dbt in mind.

Happy to help contribute to this :)

I just merged https://github.com/fishtown-analytics/dbt/pull/800 which implements this feature. Thanks for all of your hard work @abelsonlive and @jon-rtr :)

This will go out in our 0.10.2 release!

thank you so much for bringing this one home! happy independence day. go eat a burger :p

Was this page helpful?
0 / 5 - 0 ratings