-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit b1e950b)
- Loading branch information
1 parent
05f2b0f
commit 5d821c4
Showing
7 changed files
with
556 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Support model contracts + constraints on nested columns | ||
time: 2023-06-01T14:12:55.433346-04:00 | ||
custom: | ||
Author: MichelleArk | ||
Issue: "673" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
my_model_struct_wrong_data_type_sql = """ | ||
{{ config(materialized = "table") }} | ||
select | ||
STRUCT(1 AS struct_column_being_tested, "test" AS another_struct_column) as a | ||
""" | ||
|
||
my_model_struct_correct_data_type_sql = """ | ||
{{ config(materialized = "table")}} | ||
select | ||
STRUCT("test" AS struct_column_being_tested, "test" AS b) as a | ||
""" | ||
|
||
model_struct_data_type_schema_yml = """ | ||
version: 2 | ||
models: | ||
- name: contract_struct_wrong | ||
config: | ||
contract: | ||
enforced: true | ||
columns: | ||
- name: a.struct_column_being_tested | ||
data_type: string | ||
- name: a.b | ||
data_type: string | ||
- name: contract_struct_correct | ||
config: | ||
contract: | ||
enforced: true | ||
columns: | ||
- name: a.struct_column_being_tested | ||
data_type: string | ||
- name: a.b | ||
data_type: string | ||
""" | ||
|
||
my_model_double_struct_wrong_data_type_sql = """ | ||
{{ config(materialized = "table") }} | ||
select | ||
STRUCT( | ||
STRUCT(1 AS struct_column_being_tested, "test" AS c) as b, | ||
"test" as d | ||
) as a | ||
""" | ||
|
||
my_model_double_struct_correct_data_type_sql = """ | ||
{{ config(materialized = "table") }} | ||
select | ||
STRUCT( | ||
STRUCT("test" AS struct_column_being_tested, "test" AS c) as b, | ||
"test" as d | ||
) as a | ||
""" | ||
|
||
model_double_struct_data_type_schema_yml = """ | ||
version: 2 | ||
models: | ||
- name: contract_struct_wrong | ||
config: | ||
contract: | ||
enforced: true | ||
columns: | ||
- name: a.b.struct_column_being_tested | ||
data_type: string | ||
- name: a.b.c | ||
data_type: string | ||
- name: a.d | ||
data_type: string | ||
- name: contract_struct_correct | ||
config: | ||
contract: | ||
enforced: true | ||
columns: | ||
- name: a.b.struct_column_being_tested | ||
data_type: string | ||
- name: a.b.c | ||
data_type: string | ||
- name: a.d | ||
data_type: string | ||
""" | ||
|
||
|
||
my_model_struct_sql = """ | ||
{{ | ||
config( | ||
materialized = "table" | ||
) | ||
}} | ||
select STRUCT("test" as nested_column, "test" as nested_column2) as id | ||
""" | ||
|
||
|
||
model_struct_schema_yml = """ | ||
version: 2 | ||
models: | ||
- name: my_model | ||
config: | ||
contract: | ||
enforced: true | ||
columns: | ||
- name: id.nested_column | ||
quote: true | ||
data_type: string | ||
description: hello | ||
constraints: | ||
- type: not_null | ||
- type: unique | ||
- name: id.nested_column2 | ||
data_type: string | ||
constraints: | ||
- type: unique | ||
""" |
Oops, something went wrong.