You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current model contract comparison (assert_columns_equivalentmacro) validates that the user-provided column names and data types are identical: in name, type, and order the column names obtained from the model SQL.
However, it will be cumbersome for users to ensure that the order of configured columns in a model yaml file always matches with the order the database provides.
For example, the SQL model configured with the schema below fails its contract check:
-- model.sqlSELECT1as a, 2as b
-- schema.ymlmodels:
- model:
contract: Truecolumns:
- name: bdata_type: INT
- name: adata_type: INT
Note: should not be merged before #7064, as this ordering check is currently done in assert_columns_equivalent and prevents constraint ddl generation from being generated in an invalid order.
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Make model contracts agnostic to ordering
[CT-2121] Make model contracts agnostic to ordering
Feb 14, 2023
The current model contract comparison (
assert_columns_equivalent
macro) validates that the user-provided column names and data types are identical: in name, type, and order the column names obtained from the model SQL.However, it will be cumbersome for users to ensure that the order of configured columns in a model yaml file always matches with the order the database provides.
For example, the SQL model configured with the schema below fails its contract check:
The equality comparison is done directly on formatted columns from the SQL + schema yaml, and could instead be done on the intermediate collection of unordered columns.
Relevant discussion: #6271 (comment)
Note: should not be merged before #7064, as this ordering check is currently done in
assert_columns_equivalent
and prevents constraint ddl generation from being generated in an invalid order.The text was updated successfully, but these errors were encountered: