I have added target name to a job with the value: “production”
And in the generate_schema_name
macro I have this simple IF statement:
{%- if target.name == 'production' -%}
{{ custom_schema_name }}
But yet when I run the job, I prepends the value of schema from Deployment Credentials:
And yet we can’t leave the schema there empty. But from my understanding, the ANALYTICS
is “default_schema” and “custom_schema_name” would be from my project config, which in this test is +schema: base
.
I created a workaround by adding a replace in the macro
{{ custom_schema_name | replace("analytics_", "") }}
but I feel there could be an easier and cleaner way to do this, especially since this will require people to remember what to put in their deployment credentials, which asks for a human error sooner or later…