File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 7
7
from functools import cached_property
8
8
from operator import itemgetter
9
9
from typing import TYPE_CHECKING , Any
10
- from urllib .parse import unquote_plus
10
+ from urllib .parse import unquote_plus , urlparse
11
11
12
12
import sqlglot as sg
13
13
import sqlglot .expressions as sge
14
14
import trino
15
+ from trino .auth import BasicAuthentication
15
16
16
17
import ibis
17
18
import ibis .backends .sql .compilers as sc
@@ -309,10 +310,20 @@ def do_connect(
309
310
raise ValueError (
310
311
"Cannot specify both `auth` and `password` when connecting to Trino"
311
312
)
313
+ else :
314
+ auth = password
312
315
warnings .warn (
313
316
"The `password` parameter is deprecated and will be removed in 10.0; use `auth` instead" ,
314
317
FutureWarning ,
315
318
)
319
+
320
+ if (
321
+ isinstance (auth , str )
322
+ and (scheme := urlparse (host ).scheme )
323
+ and scheme != "http"
324
+ ):
325
+ auth = BasicAuthentication (user , auth )
326
+
316
327
self .con = trino .dbapi .connect (
317
328
user = user ,
318
329
host = host ,
@@ -321,7 +332,7 @@ def do_connect(
321
332
schema = schema ,
322
333
source = source or "ibis" ,
323
334
timezone = timezone ,
324
- auth = auth or password ,
335
+ auth = auth ,
325
336
** kwargs ,
326
337
)
327
338
You can’t perform that action at this time.
0 commit comments