Skip to content

Commit 1f5cdff

Browse files
fixup! Add defer_connect config to allow eagerly verifying connection
1 parent 676c42a commit 1f5cdff

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

trino/dbapi.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def __init__(
159159
legacy_prepared_statements=None,
160160
roles=None,
161161
timezone=None,
162-
defer_connect=True,
162+
defer_connect=False,
163163
):
164164
# Automatically assign http_schema, port based on hostname
165165
parsed_host = urlparse(host, allow_fragments=False)
@@ -224,13 +224,8 @@ def connect(self) -> None:
224224
test_response = connection_test_request.post("<not-going-to-be-executed>")
225225
if not test_response.ok:
226226
raise trino.exceptions.TrinoConnectionError(
227-
"error {}{}".format(
228-
test_response.status_code,
229-
": {}".format(test_response.content)
230-
if test_response.content
231-
else "",
232-
)
233-
)
227+
"error " + str(test_response.status_code) + (": " + test_response.content if test_response.content else ""))
228+
234229
except RequestException as e:
235230
raise trino.exceptions.TrinoConnectionError("connection failed: {}".format(e))
236231

0 commit comments

Comments
 (0)