AN-2390/update-vars-udf-sp-opt (#46)

* added project level variable and associated IF statements to on-run-start macros to default UDF/SP updates to False

* readjusted spacing in macros
This commit is contained in:
drethereum 2022-11-11 11:10:02 -07:00 committed by GitHub
parent 3260e3556d
commit 86699e12f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 11 deletions

View File

@ -40,3 +40,4 @@ on-run-start:
vars:
"dbt_date:time_zone": GMT
UPDATE_UDFS_AND_SPS: False

View File

@ -1,6 +1,8 @@
{% macro create_sps() %}
{% if target.database == 'OPTIMISM' %}
CREATE schema IF NOT EXISTS _internal;
{{ sp_create_prod_clone('_internal') }};
{% if var("UPDATE_UDFS_AND_SPS") %}
{% if target.database == 'OPTIMISM' %}
CREATE schema IF NOT EXISTS _internal;
{{ sp_create_prod_clone('_internal') }};
{% endif %}
{% endif %}
{% endmacro %}

View File

@ -1,11 +1,13 @@
{% macro create_udfs() %}
{% set sql %}
CREATE schema if NOT EXISTS silver;
{{ create_js_hex_to_int() }};
{{ create_udf_hex_to_int(
schema = "public"
) }}
{% if var("UPDATE_UDFS_AND_SPS") %}
{% set sql %}
CREATE schema if NOT EXISTS silver;
{{ create_js_hex_to_int() }};
{{ create_udf_hex_to_int(
schema = "public"
) }}
{% endset %}
{% do run_query(sql) %}
{% endset %}
{% do run_query(sql) %}
{% endif %}
{% endmacro %}