File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1051,7 +1051,7 @@ def _data_hash_values(self) -> t.List[str]:
10511051
10521052 for column_name , column_type in (self .columns_to_types_ or {}).items ():
10531053 data .append (column_name )
1054- data .append (column_type .sql ())
1054+ data .append (column_type .sql (dialect = self . dialect ))
10551055
10561056 for key , value in (self .physical_properties or {}).items ():
10571057 data .append (key )
Original file line number Diff line number Diff line change 1+ """Use the model's dialect when calculating the hash for the column types."""
2+
3+
4+ def migrate (state_sync , ** kwargs ): # type: ignore
5+ pass
Original file line number Diff line number Diff line change @@ -8435,3 +8435,20 @@ def test_ignored_rules_serialization():
84358435
84368436 deserialized_model = SqlModel .parse_raw (model_json )
84378437 assert deserialized_model .dict () == model .dict ()
8438+
8439+
8440+ def test_data_hash_unchanged_when_column_type_uses_default_dialect ():
8441+ model = create_sql_model (
8442+ "foo" ,
8443+ parse_one ("SELECT * FROM bla" ),
8444+ columns = {"a" : exp .DataType .build ("int" )},
8445+ dialect = "bigquery" ,
8446+ )
8447+
8448+ deserialized_model = SqlModel .parse_raw (model .json ())
8449+
8450+ assert model .columns_to_types_ == {"a" : exp .DataType .build ("int" )}
8451+ assert deserialized_model .columns_to_types_ == {"a" : exp .DataType .build ("bigint" )}
8452+
8453+ # int == int64 in bigquery
8454+ assert model .data_hash == deserialized_model .data_hash
You can’t perform that action at this time.
0 commit comments