Files
mars-elt/dbt/macros/common/check_model_exists.sql
Grzegorz Michalski 2c225d68ac init
2026-03-02 09:47:35 +01:00

16 lines
562 B
SQL

{% 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 %}