Advertisement
Guest User

Untitled

a guest
Aug 27th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import pyhs2
  2.  
  3. with pyhs2.connect(host='localhost',
  4. port=10000,
  5. authMechanism="PLAIN",
  6. user='root',
  7. password='test',
  8. database='default') as conn:
  9. with conn.cursor() as cur:
  10. #Show databases
  11. print cur.getDatabases()
  12.  
  13. #Execute query
  14. cur.execute("select * from table")
  15.  
  16. #Return column info from query
  17. print cur.getSchema()
  18.  
  19. #Fetch table results
  20. for i in cur.fetch():
  21. print i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement