Skip to content

Commit

Permalink
feat(trino): wrap auth strings with BasicAuthentication
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 29, 2024
1 parent a27892c commit 39e4ef5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ibis/backends/trino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sqlglot as sg
import sqlglot.expressions as sge
import trino
from trino.auth import BasicAuthentication

import ibis
import ibis.backends.sql.compilers as sc
Expand Down Expand Up @@ -309,10 +310,16 @@ def do_connect(
raise ValueError(
"Cannot specify both `auth` and `password` when connecting to Trino"
)
else:
auth = password

Check warning on line 314 in ibis/backends/trino/__init__.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/trino/__init__.py#L314

Added line #L314 was not covered by tests
warnings.warn(
"The `password` parameter is deprecated and will be removed in 10.0; use `auth` instead",
FutureWarning,
)

if isinstance(auth, str):
auth = BasicAuthentication(user, auth)

Check warning on line 321 in ibis/backends/trino/__init__.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/trino/__init__.py#L321

Added line #L321 was not covered by tests

self.con = trino.dbapi.connect(
user=user,
host=host,
Expand All @@ -321,7 +328,7 @@ def do_connect(
schema=schema,
source=source or "ibis",
timezone=timezone,
auth=auth or password,
auth=auth,
**kwargs,
)

Expand Down

0 comments on commit 39e4ef5

Please sign in to comment.