Use PyHive with SQLAlchemy
masterPyHive registers itself as a dialect for SQLAlchemy. You can create engines using the following connection strings:
- Presto:
presto://<host>:<port>/<database> - Trino:
trino+pyhive://<host>:<port>/<database> - Hive:
hive://<host>:<port>/<database>
Note: Query generation functionality in SQLAlchemy is not exhaustive; using raw SQL via text() is recommended for complex queries.
from sqlalchemy import *
from sqlalchemy.engine import create_engine
# Presto
engine = create_engine('presto://localhost:8080/hive/default')
# Trino
engine = create_engine('trino+pyhive://localhost:8080/hive/default')
# Hive
engine = create_engine('hive://localhost:10000/default')