3

The examples I've seen for Impyla are for executing command line queries,

i.e. the equivalent to running

hive -e 'select * from my_db.my_table'

Is there functionality in Impyla to be able to run something like :

hive -f create_hive_table.hql \
     -hiveconf my_db=db1 \
     -hiveconf my_table=tbl1
Ambrish
  • 3,627
  • 2
  • 27
  • 42
John
  • 1,167
  • 1
  • 16
  • 33

1 Answers1

0

I just connect to Hive using the default HiveServer2 port.

Default ports: For Impala -> 21050 , For Hive -> 10000

  • No Security
from impala.dbapi import connect

conn = connect(host='myhost', port=10000, auth_mechanism="NOSASL")
cursor = conn.cursor()
cursor.execute('show databases')
print(cursor.fetchall())
  • LDAP
from impala.dbapi import connect

conn = connect(host='myhost', port=10000, auth_mechanism='LDAP', password='ldap_pass', user='user', use_ssl=True)
cursor = conn.cursor()
cursor.execute('show databases')
print(cursor.fetchall())
Ermolai
  • 303
  • 4
  • 15