Skip to content

Instantly share code, notes, and snippets.

@tommarute
Last active February 6, 2018 15:11
Show Gist options
  • Save tommarute/b9c37d374664079910e51085cf48cd23 to your computer and use it in GitHub Desktop.
Save tommarute/b9c37d374664079910e51085cf48cd23 to your computer and use it in GitHub Desktop.
Sample code of kerberos auth by using prestodb. It doesn't work.
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