|
17 | 17 | from dataclasses import dataclass |
18 | 18 |
|
19 | 19 | from sqlglot import exp |
| 20 | +from sqlmesh.core.console import get_console |
20 | 21 | from sqlmesh.utils.migration import index_text_type, blob_text_type |
21 | 22 |
|
22 | 23 |
|
@@ -81,14 +82,15 @@ def migrate(state_sync, **kwargs): # type: ignore |
81 | 82 | for var, value in dict(blueprint_vars).items(): |
82 | 83 | lowercase_var = var.lower() |
83 | 84 | if var != lowercase_var: |
84 | | - # Ensures that we crash instead of overwriting snapshot payloads incorrectly |
85 | | - assert lowercase_var not in blueprint_vars, ( |
86 | | - "SQLMesh could not migrate the state database successfully, because it detected " |
87 | | - f"two different blueprint variable names ('{var}' and '{lowercase_var}') that resolve " |
88 | | - f"to the same name ('{lowercase_var}') for model '{node['name']}'. Downgrade the local " |
89 | | - "SQLMesh version to the previously-installed one, rename either of these variables, " |
90 | | - "apply the corresponding plan and try again." |
91 | | - ) |
| 85 | + if lowercase_var in blueprint_vars: |
| 86 | + get_console().log_warning( |
| 87 | + "SQLMesh is unable to fully migrate the state database, because the " |
| 88 | + f"model '{node['name']}' contains two blueprint variables ('{var}' and " |
| 89 | + f"'{lowercase_var}') that resolve to the same value ('{lowercase_var}'). " |
| 90 | + "This may result in unexpected changes being reported by the next " |
| 91 | + "`sqlmesh plan` command. If this happens, consider renaming either variable, " |
| 92 | + "so that they won't resolve to their names won't clash when lowercased." |
| 93 | + ) |
92 | 94 |
|
93 | 95 | del blueprint_vars[var] |
94 | 96 | blueprint_vars[lowercase_var] = value |
|
0 commit comments