sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

Fabric Warehouse - Alter table not available

Open fresioAS opened this issue 4 months ago • 0 comments

Alter table does not exist in Fabric Warehouse (!)

2025-09-18 10:14:56,756 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ WITH [cte_planset_union] AS (<REDACTED>); (base.py:2498)
2025-09-18 10:14:56,875 - MainThread - sqlmesh.core.snapshot.evaluator - INFO - Migrating table schema from 'my_warehouse.sqlmesh__timeplan.timeplan__planset_all__267513998_schema_tmp' to 'my_warehouse.sqlmesh__timeplan.timeplan__planset_all__267513998' (evaluator.py:1141)
2025-09-18 10:14:56,877 - MainThread - sqlmesh.core.snapshot.evaluator - INFO - Altering table 'my_warehouse.sqlmesh__timeplan.timeplan__planset_all__267513998' (evaluator.py:1831)
2025-09-18 10:14:56,877 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ SELECT DB_NAME(); (base.py:2498)
2025-09-18 10:14:56,910 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ SELECT DB_NAME(); (base.py:2498)
2025-09-18 10:14:56,948 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ SELECT [COLUMN_NAME], [DATA_TYPE], [CHARACTER_MAXIMUM_LENGTH], [NUMERIC_PRECISION], [NUMERIC_SCALE] FROM [INFORMATION_SCHEMA].[COLUMNS] WHERE [TABLE_NAME] = 'timeplan__planset_all__267513998' AND [TABLE_SCHEMA] = 'sqlmesh__timeplan'; (base.py:2498)
2025-09-18 10:14:57,010 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ SELECT [COLUMN_NAME], [DATA_TYPE], [CHARACTER_MAXIMUM_LENGTH], [NUMERIC_PRECISION], [NUMERIC_SCALE] FROM [INFORMATION_SCHEMA].[COLUMNS] WHERE [TABLE_NAME] = 'timeplan__planset_all__267513998_schema_tmp' AND [TABLE_SCHEMA] = 'sqlmesh__timeplan'; (base.py:2498)
2025-09-18 10:14:57,074 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ ALTER TABLE [my_warehouse].[sqlmesh__timeplan].[timeplan__planset_all__267513998] ALTER COLUMN [planset] VARCHAR(MAX); (base.py:2498)
2025-09-18 10:14:57,114 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ SELECT DB_NAME(); (base.py:2498)
2025-09-18 10:14:57,150 - MainThread - sqlmesh.core.engine_adapter.base - INFO - Executing SQL: /* SQLMESH_PLAN: c4be7319bc834acf8c5a20d0e4019d21 */ DROP TABLE IF EXISTS [sqlmesh__timeplan].[timeplan__planset_all__267513998_schema_tmp]; (base.py:2498)
2025-09-18 10:14:57,310 - MainThread - sqlmesh.core.analytics.dispatcher - DEBUG - Analytics is disabled, dropping event (dispatcher.py:187)
2025-09-18 10:14:57,315 - MainThread - sqlmesh.core.context - INFO - Plan application failed. (context.py:1735)

sqlmesh.utils.errors.PlanError: ('42000', '[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]The specified ALTER TABLE statement is not supported in this edition of SQL Server. (24585) (SQLExecDirectW)')

The not so elegant workaround would be something like adding/dropping a column on the table or directly dropping/recreating the full table?

Any advice on how to handle this - perhaps best to wait it out until MSFT fixes this on Fabric Warehouse? https://learn.microsoft.com/en-us/fabric/data-warehouse/tsql-surface-area#limitations

fresioAS avatar Sep 18 '25 08:09 fresioAS