Skip to content

Commit 68b1c5a

Browse files
committed
timeout
1 parent 50969c2 commit 68b1c5a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/sempy_labs/_sql_endpoints.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@ def refresh_sql_endpoint_metadata(
128128
else:
129129
raise ValueError("Invalid type. Must be 'Lakehouse' or 'MirroredDatabase'.")
130130

131+
timeout_unit = timeout_unit.capitalize()
132+
if timeout_unit not in ["Seconds", "Minutes", "Hours", "Days"]:
133+
raise ValueError(
134+
"Invalid timeout_unit. Must be 'Seconds', 'Minutes', 'Hours', or 'Days'."
135+
)
136+
if timeout_unit == "Hours" and timeout_value > 24:
137+
raise ValueError("timeout_value cannot exceed 24 when timeout_unit is 'Hours'.")
138+
if timeout_unit == "Days" and timeout_value > 1:
139+
raise ValueError("timeout_value cannot exceed 1 when timeout_unit is 'Days'.")
140+
if timeout_unit == "Minutes" and timeout_value > 1440:
141+
raise ValueError(
142+
"timeout_value cannot exceed 1440 when timeout_unit is 'Minutes'."
143+
)
144+
if timeout_unit == "Seconds" and timeout_value > 86400:
145+
raise ValueError(
146+
"timeout_value cannot exceed 86400 when timeout_unit is 'Seconds'."
147+
)
148+
131149
payload = {"timeout": {"timeUnit": timeout_unit, "value": timeout_value}}
132150

133151
result = _base_api(

0 commit comments

Comments
 (0)