diff --git a/CHANGES.md b/CHANGES.md index ab90f7e..ef4eb9f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ ## Changelog +# dbt-dry-run v0.7.x + +## Improvements + +- Support RANGE datatype + # dbt-dry-run v0.7.7 ## Improvements diff --git a/dbt_dry_run/literals.py b/dbt_dry_run/literals.py index 31485b6..501fef2 100644 --- a/dbt_dry_run/literals.py +++ b/dbt_dry_run/literals.py @@ -25,6 +25,7 @@ BigQueryFieldType.NUMERIC: lambda: "CAST(1 AS NUMERIC)", BigQueryFieldType.BIGNUMERIC: lambda: "CAST(2 AS BIGNUMERIC)", BigQueryFieldType.JSON: lambda: "PARSE_JSON('{\"a\": 1}')", + BigQueryFieldType.RANGE: lambda: "RANGE(DATE '2022-12-01', DATE '2022-12-31')", } _EXAMPLE_VALUES_TEST: Dict[BigQueryFieldType, Callable[[], str]] = { @@ -45,6 +46,7 @@ BigQueryFieldType.NUMERIC: lambda: "CAST(1 AS NUMERIC)", BigQueryFieldType.BIGNUMERIC: lambda: "CAST(2 AS BIGNUMERIC)", BigQueryFieldType.JSON: lambda: "PARSE_JSON('{\"a\": 1}')", + BigQueryFieldType.RANGE: lambda: "RANGE(DATE '2022-12-01', DATE '2022-12-31')", } _ACTIVE_EXAMPLE_VALUES = _EXAMPLE_VALUES diff --git a/dbt_dry_run/models/table.py b/dbt_dry_run/models/table.py index 69bef9f..c851c5b 100644 --- a/dbt_dry_run/models/table.py +++ b/dbt_dry_run/models/table.py @@ -34,6 +34,7 @@ class BigQueryFieldType(str, Enum): STRUCT = "STRUCT" JSON = "JSON" RECORD = "RECORD" + RANGE = "RANGE" class TableField(BaseModel): diff --git a/integration/projects/test_models_are_executed/models/model_with_all_column_types.sql b/integration/projects/test_models_are_executed/models/model_with_all_column_types.sql index 9b17423..3cf0d1a 100644 --- a/integration/projects/test_models_are_executed/models/model_with_all_column_types.sql +++ b/integration/projects/test_models_are_executed/models/model_with_all_column_types.sql @@ -38,6 +38,7 @@ simple_column_types AS ( CAST(1 AS NUMERIC) AS my_numeric, CAST(2 AS BIGNUMERIC) AS my_bignumeric, PARSE_JSON('{"a": 1}') AS my_json, + RANGE(DATE '2022-12-01', DATE '2022-12-31') as my_range ), all_column_types AS ( SELECT * FROM simple_column_types @@ -65,4 +66,5 @@ SELECT my_json, my_struct, my_array_of_records, + my_range FROM all_column_types diff --git a/integration/projects/test_models_are_executed/test_models_are_executed.py b/integration/projects/test_models_are_executed/test_models_are_executed.py index 9f9c9ee..c4c9602 100644 --- a/integration/projects/test_models_are_executed/test_models_are_executed.py +++ b/integration/projects/test_models_are_executed/test_models_are_executed.py @@ -87,5 +87,6 @@ def test_model_with_all_column_types_succeeds(dry_run_result: DryRunResult): "my_array_of_records", "my_array_of_records.col_1", "my_array_of_records.col_2", + "my_range", } assert_report_node_has_columns(node, expected_column_names)