diff --git a/CHANGELOG.md b/CHANGELOG.md index 28b1caf2f..2dccb571b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## dbt-bigquery 1.2.0rc1 (Release TBD) + +### Under the hood +- Modify `BigQueryColumn.numeric_type` to always exclude precision + scale, since the functionality of ["parametrized data types on BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#parameterized_data_types) is highly constrained ([#214](https://github.com/dbt-labs/dbt-bigquery/pull/214)) + ## dbt-bigquery 1.2.0b1 (June 24, 2022) ### Fixes diff --git a/dbt/adapters/bigquery/column.py b/dbt/adapters/bigquery/column.py index 2422fcc0b..1a6d042b6 100644 --- a/dbt/adapters/bigquery/column.py +++ b/dbt/adapters/bigquery/column.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from typing import Optional, List, TypeVar, Iterable, Type +from typing import Optional, List, TypeVar, Iterable, Type, Any from dbt.adapters.base.column import Column @@ -92,6 +92,12 @@ def data_type(self) -> str: else: return field_type + @classmethod + def numeric_type(cls, dtype: str, precision: Any, scale: Any) -> str: + # BigQuery makes life much harder if precision + scale are specified + # even if they're fed in here, just return the data type by itself + return dtype + def is_string(self) -> bool: return self.dtype.lower() == "string" diff --git a/tests/functional/adapter/utils/test_data_types.py b/tests/functional/adapter/utils/test_data_types.py new file mode 100644 index 000000000..af084a0ef --- /dev/null +++ b/tests/functional/adapter/utils/test_data_types.py @@ -0,0 +1,34 @@ +import pytest +from dbt.tests.adapter.utils.data_types.test_type_bigint import BaseTypeBigInt +from dbt.tests.adapter.utils.data_types.test_type_float import BaseTypeFloat +from dbt.tests.adapter.utils.data_types.test_type_int import BaseTypeInt +from dbt.tests.adapter.utils.data_types.test_type_numeric import BaseTypeNumeric +from dbt.tests.adapter.utils.data_types.test_type_string import BaseTypeString +from dbt.tests.adapter.utils.data_types.test_type_timestamp import BaseTypeTimestamp + + +class TestTypeBigInt(BaseTypeBigInt): + pass + + +class TestTypeFloat(BaseTypeFloat): + pass + + +class TestTypeInt(BaseTypeInt): + pass + + +class TestTypeNumeric(BaseTypeNumeric): + def numeric_fixture_type(self): + return "numeric" + + +class TestTypeString(BaseTypeString): + pass + + +class TestTypeTimestamp(BaseTypeTimestamp): + pass + + \ No newline at end of file diff --git a/tests/functional/adapter/test_utils.py b/tests/functional/adapter/utils/test_utils.py similarity index 100% rename from tests/functional/adapter/test_utils.py rename to tests/functional/adapter/utils/test_utils.py