Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to specify https protcol in SQLAlchemy > Presto connection?

I'm trying to run Hive queries via Presto using SQLAlchemy. It uses LDAP authentication but I'm missing something in the connection string.

from sqlalchemy.engine import create_engine

conn_string = 'presto://' + user + ':' + passw + '@' + host + ':' + port + db \
    + ", connect_args={'auth':LDAP}"
   
eng = create_engine(conn_string)

I'm getting an error that says:

Protocol must be https when passing a password

I've seen some discussion about this when searching but don't see a clear resolution. I've tried many combinations with and without the port, db, etc. Do you know how to do it? Thank you!

like image 812
Chuck Avatar asked Oct 23 '25 18:10

Chuck


1 Answers

I ended up using a different library that worked:

import prestodb

conn=prestodb.dbapi.connect(
    host=host,
    port=port,
    user=user,
    catalog='db_name',
    schema='my_schema',
    http_scheme='https',
    auth=prestodb.auth.BasicAuthentication(user, passw)
)

Then I was able to retrieve the results and put into a dataframe. So no need for SQLAlchemy. It seems unnecessarily complicated.

like image 56
Chuck Avatar answered Oct 26 '25 09:10

Chuck