Skip to content

Commit 62ce351

Browse files
committed
Fix response format
1 parent 46a4edb commit 62ce351

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

libs/foundry-dev-tools/src/foundry_dev_tools/clients/foundry_sql_server.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import logging
56
import time
67
import warnings
78
from typing import TYPE_CHECKING, Any, Literal, overload
@@ -21,6 +22,8 @@
2122
import pyspark
2223
import requests
2324

25+
LOGGER = logging.getLogger(__name__)
26+
2427

2528
class FoundrySqlServerClient(APIClient):
2629
"""FoundrySqlServerClient class that implements methods from the 'foundry-sql-server' API."""
@@ -415,12 +418,10 @@ def _extract_query_identifier(self, response_json: dict[str, Any]) -> dict[str,
415418
Query identifier dict
416419
417420
"""
418-
if response_json.get("type") == "pending":
419-
return response_json["pending"]["query"]
420-
if response_json.get("type") == "success":
421-
return response_json["success"]["query"]
422-
msg = f"Unexpected response type: {response_json.get('type')}"
423-
raise ValueError(msg)
421+
if response_json["type"] == "triggered" and "plan" in response_json["triggered"]:
422+
plan = response_json["triggered"]["plan"]
423+
LOGGER.debug("plan %s", plan)
424+
return response_json[response_json["type"]]["query"]
424425

425426
def _extract_tickets(self, response_json: dict[str, Any]) -> list[str]:
426427
"""Extract tickets from success response.

0 commit comments

Comments
 (0)