Skip to content

Commit

Permalink
fixup! Add defer_connect config to allow eagerly verifying connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaheer-rossoneri14 committed Aug 21, 2023
1 parent 676c42a commit 1f5cdff
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions trino/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __init__(
legacy_prepared_statements=None,
roles=None,
timezone=None,
defer_connect=True,
defer_connect=False,
):
# Automatically assign http_schema, port based on hostname
parsed_host = urlparse(host, allow_fragments=False)
Expand Down Expand Up @@ -224,13 +224,8 @@ def connect(self) -> None:
test_response = connection_test_request.post("<not-going-to-be-executed>")
if not test_response.ok:
raise trino.exceptions.TrinoConnectionError(
"error {}{}".format(
test_response.status_code,
": {}".format(test_response.content)
if test_response.content
else "",
)
)
"error " + str(test_response.status_code) + (": " + test_response.content if test_response.content else ""))

except RequestException as e:
raise trino.exceptions.TrinoConnectionError("connection failed: {}".format(e))

Expand Down

0 comments on commit 1f5cdff

Please sign in to comment.