Skip to content

Commit

Permalink
When using incremental tables, the column data types are invalidly up…
Browse files Browse the repository at this point in the history
…dated (#269)
  • Loading branch information
gshank authored Jul 29, 2024
1 parent 4b2755d commit b64d3a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240728-221030.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Incremental table varchar column definition changed
time: 2024-07-28T22:10:30.673107-04:00
custom:
Author: gshank
Issue: "276"
3 changes: 0 additions & 3 deletions dbt/adapters/base/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ def numeric_type(cls, dtype: str, precision: Any, scale: Any) -> str:
else:
return "{}({},{})".format(dtype, precision, scale)

def __repr__(self) -> str:
return "<Column {} ({})>".format(self.name, self.data_type)

@classmethod
def from_description(cls, name: str, raw_data_type: str) -> "Column":
match = re.match(r"([^(]+)(\([^)]+\))?", raw_data_type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@
{% set need_swap = true %}
{% else %}
{% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}
{% do adapter.expand_target_column_types(
from_relation=temp_relation,
to_relation=target_relation) %}
{% set contract_config = config.get('contract') %}
{% if not contract_config or not contract_config.enforced %}
{% do adapter.expand_target_column_types(
from_relation=temp_relation,
to_relation=target_relation) %}
{% endif %}
{#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}
{% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}
{% if not dest_columns %}
Expand Down

0 comments on commit b64d3a5

Please sign in to comment.