init
This commit is contained in:
19
dbt/macros/check_data_exists.sql
Normal file
19
dbt/macros/check_data_exists.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
{% macro check_data_exists(table_name) %}
|
||||
{% if execute %}
|
||||
|
||||
{% set run_sql %}
|
||||
select count(*)
|
||||
from (
|
||||
select 1 res
|
||||
from {{ table_name }}
|
||||
where rownum = 1
|
||||
)
|
||||
{% endset %}
|
||||
|
||||
{% set res = run_query(run_sql) %}
|
||||
{% set row_ct = res.columns[0].values()[0] %}
|
||||
|
||||
{{ return(row_ct) }}
|
||||
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user