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