Skip to content

Commit 8efa68c

Browse files
[nit] reduce nested code
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 5005b13 commit 8efa68c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/databricks/sql/backend/sea_backend.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ def _extract_warehouse_id(self, http_path: str) -> str:
9898

9999
for pattern in [warehouse_pattern, endpoint_pattern]:
100100
match = pattern.match(http_path)
101-
if match:
102-
warehouse_id = match.group(1)
103-
logger.debug(
104-
f"Extracted warehouse ID: {warehouse_id} from path: {http_path}"
105-
)
106-
return warehouse_id
101+
if not match:
102+
continue
103+
warehouse_id = match.group(1)
104+
logger.debug(
105+
f"Extracted warehouse ID: {warehouse_id} from path: {http_path}"
106+
)
107+
return warehouse_id
107108

108109
# If no match found, raise error
109110
error_message = (

0 commit comments

Comments
 (0)