Skip to content

Commit 74bff92

Browse files
committed
Add status message
1 parent a1d4d43 commit 74bff92

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

singlestoredb/fusion/handlers/export.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,19 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]:
217217
wsg = get_workspace_group({})
218218
out = ExportStatus(params['export_id'], wsg)
219219

220+
status = out._info()
221+
220222
res = FusionSQLResult()
221223
res.add_field('ExportID', result.STRING)
222224
res.add_field('Status', result.STRING)
223-
res.set_rows([(params['export_id'], out.status)])
225+
res.add_field('Message', result.STRING)
226+
res.set_rows([
227+
(
228+
params['export_id'],
229+
status.get('status', 'Unknown'),
230+
status.get('statusMsg', ''),
231+
),
232+
])
224233

225234
return res
226235

singlestoredb/management/export.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ def __init__(self, export_id: str, workspace_group: WorkspaceGroup):
279279
self.workspace_group = workspace_group
280280
self._manager: Optional[WorkspaceManager] = workspace_group._manager
281281

282-
@property
283-
def status(self) -> str:
282+
def _info(self) -> Dict[str, Any]:
284283
"""Return export status."""
285284
if self._manager is None:
286285
raise ManagementError(
@@ -292,9 +291,17 @@ def status(self) -> str:
292291
json=dict(egressID=self.export_id),
293292
)
294293

295-
print(out.json())
294+
return out.json()
295+
296+
@property
297+
def status(self) -> str:
298+
"""Return export status."""
299+
return self._info().get('status', 'Unknown')
296300

297-
return list(out.json().values())[0]
301+
@property
302+
def message(self) -> str:
303+
"""Return export status message."""
304+
return self._info().get('statusMsg', '')
298305

299306
def __str__(self) -> str:
300307
return self.status

0 commit comments

Comments
 (0)