'Extracting ref and source tables from a dbt model
I have a model in dbt which uses different sources and ref tables. So my question is... Is it possible to create a macro that will extract all the ref and source tables from the model? Let me give you and example
I have this model:
select
*
from {{ ref('x') }} a
left join {{ source('landing', 'y') }} ma on a.... = ma....
left join {{ source('landing', 'z') }} b on a.... = b....
So, once the macro is run for that model, I would like to get the names or the ref and source tables. Is that possible? I would like to do this in dbt, but let me know if it would be better to use python instead.
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|