0

I'm all alone on my team with basically no technical support and first person to do this so I have nobody to turn to.

I'm able to use the connect statement. I think I have this right since I have no errors! here. If I change anything in my connect statement I get error messages.

I then try to create a cursor. cursor=conn.cursor(). No errors!

But when I go to then try to send out any query, I get nothing back.

I don't know what I'm missing here. Again I'm all alone with nobody technical to explain what I could be doing wrong. I assume I'm connecting to the database properly since I get errors on the connect function otherwise. What am I doing wrong or overlooking?

import pandas as pd 
import numpy as np 
from impala.dbapi import connect


conn = connect(host='xyz123', port = 21050, user='my_name', password='my_password', auth_mechanism ='GSSAPI')

#no errors.  
# I don't know what GSSAPI is..
# but if I do anything else I get an error message
# if I change anything in above statement I get an error so I know this is right...

cursor = conn.cursor() 
#no errors! yay

result=cursor.execute("select * from mydb.any_table limit 10"
# <<result is NULL>

result # <<null, nothing>>
runningbirds
  • 6,235
  • 13
  • 55
  • 94

1 Answers1

0

you have to fetch the records after select:

result  = cursor.execute("select * from mydb.any_table limit 10")
records = cursor.fetchall()
reccount= len(records)

for i in range(reccount):
    record = records[i][0]
    print(record)
Jani
  • 1