Skip to content

Commit

Permalink
Support RANGE type
Browse files Browse the repository at this point in the history
  • Loading branch information
ccharlesgb committed May 14, 2024
1 parent dd42ae0 commit afe35a6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog

# dbt-dry-run v0.7.x

## Improvements

- Support RANGE datatype

# dbt-dry-run v0.7.7

## Improvements
Expand Down
2 changes: 2 additions & 0 deletions dbt_dry_run/literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = {
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions dbt_dry_run/models/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class BigQueryFieldType(str, Enum):
STRUCT = "STRUCT"
JSON = "JSON"
RECORD = "RECORD"
RANGE = "RANGE"


class TableField(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -65,4 +66,5 @@ SELECT
my_json,
my_struct,
my_array_of_records,
my_range
FROM all_column_types
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit afe35a6

Please sign in to comment.