Tomme / dbt-athena

The athena adapter plugin for dbt (https://getdbt.com)
Apache License 2.0
140 stars 79 forks source link

Assume lowercase database object names #59

Closed aut0clave closed 2 years ago

aut0clave commented 2 years ago

From https://docs.aws.amazon.com/athena/latest/ug/tables-databases-columns-names.html

Athena accepts mixed case in DDL and DML queries, but lower cases the names when it executes the query.

Macros athena__list_relations_without_caching and athena__get_columns_in_relation wrap references to information_schema.table_schema and information_schema.table_name in LOWER(), which I think is unnecessary.

In my testing, the queries executed by these macros perform significantly faster when LOWER() is removed from the information_schema references.

Macro Seconds to run with LOWER() Seconds to run without LOWER()
list_relations_without_caching 29.6 12.3
get_columns_in_relation 17.5 0.5