I am trying to play around with this simple sql query using cursor:
import jaydebeapi,pandas as pd
conn = <connection to TeraData>
cursor = conn.cursor()
sql = ("Select top 10 * from Car_Sales")
data = cursor.execute(sql)
print(data.query)
row = data.fetchone()
#rows = data.fetchall()
print(row)
Error I am getting is:
AttributeError: 'NoneType' object has no attribute 'fetchone'
It has been couple hours trying to find the issue but not getting anywhere on this. Looked different resources online but still the issue remains.
Please let me know where am I going wrong?
Update:
When I executed the same query in Pandas:
pd.read_sql_query('select top 10 * from Car_Sales',conn)
Output:
Car_Sales
0 112
1 77
2 226
3 990
4 552
5 887
datais None. Maybe your SQL query is invalid? "Select top 10 * Car_Sales" doesn't look like a correct query to me