How do I create dynamic models getting information on source tables and target tables from a metadata table using the same jinja code?
I tried running below code but the config() does not seem to be working
{% if execute %}
{% set table_mappings1 = run_query(‘select source from x’).columns[0].values() %}
{% endif %}
{% if execute %}
{% set table_mappings2 = run_query(‘select target from x’).columns[0].values() %}
{% endif %}
{% for c1,c2 in zip(table_mappings1,table_mappings2) %}
{{config(materialized=‘table’, alias=‘{{c2}}’)}}
select * from {{c1}}
{% endfor %}