forked from Tomme/dbt-athena
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adapter: use glue API for schema and column introspection
- Loading branch information
Showing
4 changed files
with
67 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,3 @@ | ||
{% macro athena__get_columns_in_relation(relation) -%} | ||
{% call statement('get_columns_in_relation', fetch_result=True) %} | ||
|
||
select | ||
column_name, | ||
data_type, | ||
null as character_maximum_length, | ||
null as numeric_precision, | ||
null as numeric_scale | ||
|
||
from {{ relation.information_schema('columns') }} | ||
where LOWER(table_name) = LOWER('{{ relation.identifier }}') | ||
{% if relation.schema %} | ||
and LOWER(table_schema) = LOWER('{{ relation.schema }}') | ||
{% endif %} | ||
order by ordinal_position | ||
|
||
{% endcall %} | ||
|
||
{% set table = load_result('get_columns_in_relation').table %} | ||
{% do return(sql_convert_columns_in_relation(table)) %} | ||
{{ return(adapter.get_columns_in_relation(relation)) }} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
{% macro athena__drop_relation(relation) -%} | ||
{%- do adapter.clean_up_table(relation.schema, relation.table) -%} | ||
{% call statement('drop_relation', auto_begin=False) -%} | ||
drop {{ relation.type }} if exists {{ relation }} | ||
{%- endcall %} | ||
{{ return(adapter.drop_relation(relation)) }} | ||
{% endmacro %} |