mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 16:36:48 +00:00
* add: if condition * removed row_list * add: gold view, fix macro, and silver models * gold view extension * add: test bronce * g * adding test * add: test * add: working test * delete: tags * delete: hardcode ref
19 lines
473 B
SQL
19 lines
473 B
SQL
-- macros/check_table_exists.sql
|
|
{% macro check_table_exists(schema_name, table_name) %}
|
|
{% set query %}
|
|
SELECT count(*)
|
|
FROM information_schema.tables
|
|
WHERE table_schema = '{{ schema_name }}'
|
|
AND table_name = '{{ table_name }}'
|
|
{% endset %}
|
|
|
|
{% set results = run_query(query) %}
|
|
{% if execute %}
|
|
{% if results and results.rows[0][0] > 0 %}
|
|
"True"
|
|
{% else %}
|
|
"False"
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endmacro %}
|