Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyhs2
- with pyhs2.connect(host='localhost',
- port=10000,
- authMechanism="PLAIN",
- user='None',
- password='None',
- database='Default') as conn:
- with conn.cursor() as cur:
- #Show databases
- print cur.getDatabases()
- #Execute query
- cur.execute("select * from table")
- #Return column info from query
- print cur.getSchema()
- #Fetch table results
- for i in cur.fetch():
- print i
- Traceback (most recent call last):
- File "pyth_hive2.py", line 8, in <module>
- database='Default') as conn:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement