Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#1687) no-op column expansion on Snowflake + BQ #1690

Merged
merged 3 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@

{% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}

-- this may no-op if the database does not require column expansion
{% do adapter.expand_target_column_types(from_relation=staging_table,
to_relation=target_relation) %}

Expand Down
4 changes: 4 additions & 0 deletions plugins/bigquery/dbt/adapters/bigquery/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def expand_column_types(self, goal, current):
# This is a no-op on BigQuery
pass

def expand_target_column_types(self, from_relation, to_relation):
# This is a no-op on BigQuery
pass

def list_relations_without_caching(self, information_schema, schema):
connection = self.connections.get_thread_connection()
client = connection.handle
Expand Down
7 changes: 7 additions & 0 deletions plugins/snowflake/dbt/include/snowflake/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,10 @@
alter table {{ from_relation }} rename to {{ to_relation }}
{%- endcall %}
{% endmacro %}


{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}
{% call statement('alter_column_type') %}
alter table {{ relation }} alter {{ column_name }} set data type {{ new_column_type }};
{% endcall %}
{% endmacro %}