This is the code we have built for a schema clean up macro
{% macro cleanup_schemas(databases) %}
{% for database in databases %}
{% set query %}
SELECT
SCHEMA_NAME
FROM {{database}}.INFORMATION_SCHEMA.SCHEMATA
WHERE SCHEMA_NAME ILIKE 'DBT_%'
EXCEPT
SELECT
TABLE_SCHEMA
FROM {{database}}.INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA ILIKE 'DBT_%'
{% endset %}
{% set results = run_query(query) %}
{% if execute %}
{% set schemas = results.rows %}
{% for row in schemas %}
{{log("DROP SCHEMA " ~ database ~ '.' ~ row[0], info=True)}}
DROP SCHEMA {{database}}.row[0];
{% do run_query(query) %}
{% endfor %}
{% endif %}
{% endfor %}
{% endmacro %}
For whatever reason, it does not drop the schema, just runs for a bit and ends. I tried copying the log and putting it into snowflake. It drops perfectly. Is this a dbt issue?