Skip to content

Commit 73e767c

Browse files
committed
fix
1 parent 906e2de commit 73e767c

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

.circleci/manage-test-db.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ databricks_init() {
5151

5252
# Note: the cluster doesnt need to be running to create / drop catalogs, but it does need to be running to run the integration tests
5353
echo "Ensuring cluster is running"
54-
databricks clusters start $CLUSTER_ID || true
54+
databricks clusters start $CLUSTER_ID
5555
}
5656

5757
databricks_up() {

sqlmesh/core/engine_adapter/fabric.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ def create_warehouse(
179179
) -> None:
180180
"""Create a catalog (warehouse) in Microsoft Fabric via REST API."""
181181

182-
# attempt count is arbitrary, it essentially equates to 30 seconds max wait with the time.sleep() below
183-
if attempt > 3:
184-
raise SQLMeshError("Gave up waiting for warehouse to become available")
182+
# attempt count is arbitrary, it essentially equates to 5 minutes of 30 second waits
183+
if attempt > 10:
184+
raise SQLMeshError(
185+
f"Gave up waiting for Fabric warehouse {warehouse_name} to become available"
186+
)
185187

186188
logger.info(f"Creating Fabric warehouse: {warehouse_name}")
187189

@@ -202,9 +204,11 @@ def create_warehouse(
202204
return
203205
if errorCode == "ItemDisplayNameNotAvailableYet":
204206
logger.warning(f"Fabric warehouse {warehouse_name} is still spinning up; waiting")
205-
time.sleep(
206-
10
207-
) # arbitrary, seems to be "good enough" at least in CI. I was unable to find any guidance in the MS docs on how to handle this case
207+
# Fabric error message is something like:
208+
# - "Requested 'circleci_51d7087e__dev' is not available yet and is expected to become available in the upcoming minutes."
209+
# This seems to happen if a catalog is dropped and then a new one with the same name is immediately created.
210+
# There appears to be some delayed async process on the Fabric side that actually drops the warehouses and frees up the names to be used again
211+
time.sleep(30)
208212
return self.create_warehouse(
209213
warehouse_name=warehouse_name, if_not_exists=if_not_exists, attempt=attempt + 1
210214
)

tests/core/engine_adapter/integration/test_integration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3610,7 +3610,10 @@ def _set_config(_gateway: str, config: Config) -> None:
36103610

36113611
# check physical objects
36123612
snapshot_table_name = exp.to_table(new_model.table_name(), dialect=ctx.dialect)
3613-
snapshot_schema = snapshot_table_name.db
3613+
snapshot_schema = parsed_schema.copy()
3614+
snapshot_schema.set(
3615+
"db", exp.to_identifier(snapshot_table_name.db)
3616+
) # we need this to be catalog.schema and not just schema for environment_suffix_target: catalog
36143617

36153618
prod_schema = normalize_identifiers(d.to_schema(schema), dialect=ctx.dialect)
36163619
dev_env_schema = prod_schema.copy()

0 commit comments

Comments
 (0)