Last active
February 6, 2018 15:11
-
-
Save tommarute/b9c37d374664079910e51085cf48cd23 to your computer and use it in GitHub Desktop.
Sample code of kerberos auth by using prestodb. It doesn't work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import prestodb | |
from prestodb.auth import KerberosAuthentication | |
KRB5_CONFIG = "/path/to/krb5.conf" | |
CA_BUNDLE = "/path/to/cert.pem" | |
_auth = KerberosAuthentication( | |
config=KRB5_CONFIG, | |
service_name='KERBEROS', | |
mutual_authentication=False, | |
ca_bundle=CA_BUNDLE, | |
) | |
conn=prestodb.dbapi.connect( | |
host='your-presto-host.net', | |
port=8080, | |
user='the-user', | |
catalog='the-catalog', | |
schema='the-schema', | |
http_scheme='https', | |
auth=_auth, | |
) | |
query = """ | |
select | |
user_id as id, | |
user_name as name | |
from | |
users | |
where | |
user_id <= 100""" | |
cur = conn.cursor() | |
cur.execute(query) | |
rows = cur.fetchall() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment