Skip to content

Commit 12f6b98

Browse files
committed
Merge branch 'm-kovalsky/789'
2 parents fbf672a + 8197fd9 commit 12f6b98

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/sempy_labs/lakehouse/_helper.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from uuid import UUID
22
from typing import Optional, Literal
33
import pyarrow.dataset as ds
4-
from .._helper_functions import (
4+
from sempy_labs._helper_functions import (
55
_mount,
66
delete_item,
77
_base_api,
@@ -68,14 +68,16 @@ def read_vorder_tag(delta_log_path):
6868
latest_file = os.path.join(delta_log_path, json_files[0])
6969

7070
with open(latest_file, "r") as f:
71-
for line in f:
72-
try:
73-
data = json.loads(line)
74-
if "commitInfo" in data:
75-
tags = data["commitInfo"].get("tags", {})
76-
return tags.get("VORDER", "false").lower() == "true"
77-
except json.JSONDecodeError:
78-
continue # Skip malformed lines
71+
all_data = [json.loads(line) for line in f if line.strip()] # one dict per line
72+
for data in all_data:
73+
if 'metaData' in data:
74+
return data.get('metaData', {}).get('configuration', {}).get('delta.parquet.vorder.enabled', 'false') == 'true'
75+
76+
# If no metaData, fall back to commitInfo
77+
for data in all_data:
78+
if "commitInfo" in data:
79+
tags = data["commitInfo"].get("tags", {})
80+
return tags.get("VORDER", "false").lower() == "true"
7981

8082
return False # Default if not found
8183

src/sempy_labs/lakehouse/_lakehouse.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import List, Optional, Union
33
from sempy._utils._log import log
44
from uuid import UUID
5-
from .._helper_functions import (
5+
from sempy_labs._helper_functions import (
66
_base_api,
77
resolve_lakehouse_name_and_id,
88
resolve_workspace_name_and_id,
@@ -13,7 +13,7 @@
1313
import re
1414
import time
1515
import pandas as pd
16-
from .._job_scheduler import (
16+
from sempy_labs._job_scheduler import (
1717
_get_item_job_instance,
1818
)
1919

@@ -231,7 +231,7 @@ def is_valid_format(time_string):
231231
if optimize:
232232
payload["executionData"]["optimizeSettings"] = {}
233233
if v_order:
234-
payload["executionData"]["optimizeSettings"] = {"vorder": True}
234+
payload["executionData"]["optimizeSettings"] = {"vOrder": True}
235235
if vacuum:
236236
payload["executionData"]["vacuumSettings"] = {}
237237
if vacuum and retention_period is not None:
@@ -242,16 +242,17 @@ def is_valid_format(time_string):
242242
method="post",
243243
payload=payload,
244244
status_codes=202,
245+
client="fabric_sp",
245246
)
246247

247-
f"{icons.in_progress} The table maintenance job for the '{table_name}' table in the '{lakehouse_name}' lakehouse within the '{workspace_name}' workspace has been initiated."
248+
print(f"{icons.in_progress} The table maintenance job for the '{table_name}' table in the '{lakehouse_name}' lakehouse within the '{workspace_name}' workspace has been initiated.")
248249

249250
status_url = response.headers.get("Location").split("fabric.microsoft.com")[1]
250251
status = None
251252
while status not in ["Completed", "Failed"]:
252253
response = _base_api(request=status_url)
253254
status = response.json().get("status")
254-
time.sleep(10)
255+
time.sleep(3)
255256

256257
df = _get_item_job_instance(url=status_url)
257258

0 commit comments

Comments
 (0)