init
This commit is contained in:
16
dbt/macros/common/check_model_exists.sql
Normal file
16
dbt/macros/common/check_model_exists.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
{% macro check_model_exists(model_name) %}
|
||||
{% if execute %}
|
||||
{% if manifest %}
|
||||
{% set model_exists = false %}
|
||||
{% for node in manifest.nodes.values() %}
|
||||
{% if node.resource_type == 'model' and node.name == model_name %}
|
||||
{% set model_exists = true %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ return(model_exists) }}
|
||||
{% else %}
|
||||
{{ exceptions.raise_compiler_error("'manifest' object is not available in this context.") }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user