Corentin Fanton
09/01/2025, 10:13 AMdbt test with Elementary anomaly tests, Elementary (or the cleanup step triggered through Elementary) issues a DROP TABLE IF EXISTS without quoting the catalog/schema/identifier. Since our schema name contains hyphens, Athena parses “-” as subtraction and fails.
Log excerpt 18:33:20.324465 [debug] [MainThread]: On master: -- /* {"app": "dbt", "dbt_version": "1.10.9", "profile_name": "dfn", "target_name": "sales", "connection_name": "master"} / / --ELEMENTARY-METADATA-- {"command": "test", "invocation_id": "18a4eff8-9b0f-42bc-b238-65bc3ce78d77", "package_name": "dfn", "resource_name": "dfn-on-run-end-0", "resource_type": "operation"} --END-ELEMENTARY-METADATA-- */ DROP TABLE IF EXISTS AwsDataCatalog.dfn-sales-dev-dq_elementary.test_ce9b69c0cb_elementary_column_anomalies_bookings_5__null_percent__average__max__zero_percent__price__day__1__country_id__source_id__day__1__day__30__metrics__tmp_20250829163234346922
...
Athena error botocore.errorfactory.InvalidRequestException: An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 3:44: mismatched input '-'. Expecting: '.',
What we expect
• DROP statements to be rendered with proper quoting, e.g.: DROP TABLE IF EXISTS "AwsDataCatalog"."dfn-sales-dev-dq_elementary"."test_..._metrics__tmp_..."
Notes
• Project-level quoting for schema/identifier is enabled, but the statement above appears unquoted.
• We cannot change the database/schema naming convention (hyphens are mandated).
Environment
◦ Warehouse: Amazon Athena (Glue Data Catalog)
◦ dbt-core version: 1.10.9
◦ elementary version: 0.19.4
◦ Adapter: dbt-athena (dbt-athena-community wrapper)
◦ Python client: pyathena/botocore
◦ Target schema includes hyphens
◦ dbt project has quoting enabled for schema/identifier
Happy to provide full debug logs or run a minimal repro if helpful.
Thanks!kapa.ai
09/01/2025, 10:13 AMkapa.ai
09/01/2025, 10:14 AM