Skip to content

Commit 9e88ce0

Browse files
Fix Athena DROP TABLE parsing error with backtick quoting
- Replace render_pure() with backtick-quoted identifiers for Athena - Handle hyphenated schema names that cause parsing errors - Support both database.schema.table and schema.table formats - Fixes issue introduced in PR #858 where double quotes were rejected by Athena Co-Authored-By: Yosef Arbiv <[email protected]>
1 parent 98d56cf commit 9e88ce0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

macros/edr/tests/test_utils/clean_elementary_test_tables.sql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@
4242
{% macro athena__get_clean_elementary_test_tables_queries(test_table_relations) %}
4343
{% set queries = [] %}
4444
{% for test_relation in test_table_relations %}
45-
{% do queries.append("DROP TABLE IF EXISTS {}".format(test_relation.render_pure())) %}
45+
{% if test_relation.database %}
46+
{% set quoted_relation = "`{}`.`{}`.`{}`".format(test_relation.database, test_relation.schema, test_relation.identifier) %}
47+
{% else %}
48+
{% set quoted_relation = "`{}`.`{}`".format(test_relation.schema, test_relation.identifier) %}
49+
{% endif %}
50+
{% do queries.append("DROP TABLE IF EXISTS {}".format(quoted_relation)) %}
4651
{% endfor %}
4752
{% do return(queries) %}
4853
{% endmacro %}

0 commit comments

Comments
 (0)