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 Sep 3, 2024
1 parent 4d8d352 commit 36d58e1
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
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)

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 36d58e1

Please sign in to comment.