init
This commit is contained in:
15
dbt/macros/common/get_child_models.sql
Normal file
15
dbt/macros/common/get_child_models.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
{% macro get_child_models(model_name) %}
|
||||
{% if execute %}
|
||||
{% set graph = graph.nodes %}
|
||||
{% set children = [] %}
|
||||
{% for node, details in graph.items() %}
|
||||
{% for item in details.depends_on.nodes %}
|
||||
{% if model_name == item.split('.')[2] %}
|
||||
{% do children.append(node.split('.')[2]) %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{{ return(children) }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user