1414
1515from sqlmesh .core .console import get_console
1616
17+ SQLMESH_DBT_PACKAGE = "sqlmesh.dbt"
18+
1719
1820def migrate (state_sync , ** kwargs ): # type: ignore
1921 engine_adapter = state_sync .engine_adapter
@@ -23,13 +25,13 @@ def migrate(state_sync, **kwargs): # type: ignore
2325 snapshots_table = f"{ schema } .{ snapshots_table } "
2426
2527 warning = (
26- "IMPORTANT: this migration may have unexpected side-effects for dbt projects.\n \n "
2728 "SQLMesh previously misinterpreted dbt's schema.yml 'data_type' field as actual "
28- "column types, but dbt only uses these for contracts/validation, not in actual DDL statements. This "
29- "has been fixed to match dbt's actual behavior. Your existing tables may have been created with "
30- "incorrect column types. After this migration, run 'sqlmesh diff prod' to check for column "
31- "type differences, and if any are found, apply a plan to correct the table schemas. "
32- "For more details, see: https://github.com/TobikoData/sqlmesh/pull/5231."
29+ "column types, but dbt only uses these for contracts/validation, not in actual "
30+ "DDL statements. This has been fixed to match dbt's actual behavior. Your existing "
31+ "tables may have been created with incorrect column types. After this migration, run "
32+ "'sqlmesh diff prod' to check for column type differences, and if any are found, "
33+ "apply a plan to correct the table schemas. For more details, see: "
34+ "https://github.com/TobikoData/sqlmesh/pull/5231."
3335 )
3436
3537 for (snapshot ,) in engine_adapter .fetchall (
@@ -38,6 +40,9 @@ def migrate(state_sync, **kwargs): # type: ignore
3840 parsed_snapshot = json .loads (snapshot )
3941 node = parsed_snapshot ["node" ]
4042
41- if node .get ("columns" ):
43+ jinja_macros = node .get ("jinja_macros" ) or {}
44+ create_builtins_module = jinja_macros .get ("create_builtins_module" ) or ""
45+
46+ if create_builtins_module == SQLMESH_DBT_PACKAGE and node .get ("columns" ):
4247 get_console ().log_warning (warning )
4348 return
0 commit comments