diff --git a/plugins/bigquery/dbt/adapters/bigquery/impl.py b/plugins/bigquery/dbt/adapters/bigquery/impl.py index 10a8380ca67..f7f6581426a 100644 --- a/plugins/bigquery/dbt/adapters/bigquery/impl.py +++ b/plugins/bigquery/dbt/adapters/bigquery/impl.py @@ -519,13 +519,13 @@ def _partitions_match( table_field = table.time_partitioning.field return table_field == conf_partition.field elif conf_partition and table.range_partitioning is not None: - dest_part = table.range_partition.range_ + dest_part = table.range_partitioning conf_part = conf_partition.range or {} return dest_part.field == conf_partition.field \ - and dest_part.start == conf_part.get('start') \ - and dest_part.end == conf_part.get('end') \ - and dest_part.interval == conf_part.get('interval') + and dest_part.range_.start == conf_part.get('start') \ + and dest_part.range_.end == conf_part.get('end') \ + and dest_part.range_.interval == conf_part.get('interval') else: return False diff --git a/test/integration/022_bigquery_test/test_bigquery_changing_partitions.py b/test/integration/022_bigquery_test/test_bigquery_changing_partitions.py index 93a0bd60b8e..27547c54a2e 100644 --- a/test/integration/022_bigquery_test/test_bigquery_changing_partitions.py +++ b/test/integration/022_bigquery_test/test_bigquery_changing_partitions.py @@ -38,6 +38,13 @@ def test_bigquery_change_partitions(self): after = {"partition_by": "cur_date", "cluster_by": None} self.run_changes(before, after) self.run_changes(after, before) + + @use_profile('bigquery') + def test_bigquery_change_partitions_from_int(self): + before = {"partition_by": {"field": "id", "data_type": "int64", "range": {"start": 0, "end": 10, "interval": 1}}, "cluster_by": None} + after = {"partition_by": {"field": "cur_date", "data_type": "date"}, "cluster_by": None} + self.run_changes(before, after) + self.run_changes(after, before) @use_profile('bigquery') def test_bigquery_add_clustering(self):