on ‎2020 Mar 10 3:49 AM
Python
I am currently trying to access a calculated view on HANA through python using hdbcli library.
I have no problems with connecting, but when trying to query information it doesn't work.
My calculated view is hosted in a path such as this:

And I'm using this code to query:
from hdbcli import dbapi
conn = dbapi(connect(host,port,user,password)
query = "select * from HANA1.MAIN.OrdersReview.CV_Inbound_Orders"
cursor = conn.cursor()
try:
res = cursor.execute(query)
res = cursor.fetchall()
exception:
print("Something went wrong")
conn.close()
cursor.close()
I think the problem is in the query string but haven't find what it is... any ideas?
Request clarification before answering.
Hello
I would recommend that you use the data preview feature in the HANA Studio to obtain sample SQL.
To reference a calculation view you'll require a schema name, and quotes around the schema name and package/view reference, for example.
SELECT blah FROM "_SYS_BIC"."Package1.Package2.PushdownPoC/CA_WITH_STUFF"Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Michael
Thank you! It worked perfectly.
I include the query string, just in case, anyone has the same issue:
query='select top 10 * from \"_SYS_BIC\".\"Package1.Package2.PushdownPoC/CA_WITH_STUFF\"'
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.