Skip to content

Instantly share code, notes, and snippets.

@anilpai
Created March 19, 2018 19:22
Show Gist options
  • Save anilpai/545fe3017dcb159ed16b48ef65fbd173 to your computer and use it in GitHub Desktop.
Save anilpai/545fe3017dcb159ed16b48ef65fbd173 to your computer and use it in GitHub Desktop.
Connecting to JDBC databases using python
import jaydebeapi
username = ''
password = ''
conn = jaydebeapi.connect('com.qubole.jdbc.jdbc41.core.QDriver',
'jdbc:qubole://hive/default/db_name?endpoint=https://us.qubole.com',
['', password])
if conn:
print('Connection with Qubole established.')
cursor = conn.cursor()
query = 'select count(*) cnt from db_name.app'
result = cursor.execute(query)
data = cursor.fetchone()[0]
print(data)
cursor.close()
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment