Python Forum
Missing Privileges to execute a query on SAP HANA thorugh pyhdb
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Missing Privileges to execute a query on SAP HANA thorugh pyhdb
#1
Hi guys!

I'm trying to execute a simple query by using pyhdb.

Here is my code:

import pyhdb as db

HDB_TRACE=1

db.tracing =True

connection = db.connect('HOST',31047,'USER','PASSWORD')

cursor = connection.cursor()

cursor.execute("SELECT TOP 1 GLOBAL_BRAND_OWNER FROM _SYS_BIC.LAV_DWH_SELLOUT.CV_NIELSEN")

print(cursor.fetchone())

The error I get is pyhdb.exceptions.DatabaseError: insufficient privilege: Not authorized

Do you think it's due to an error in the sintax, or I am really missing some privileges?

I asked to the DB Admin and he told me that the user I'm logging in with has every possible privilege.

If I execute the query thorugh Hana Studio with the same user, it works.
Reply
#2
The error message you're encountering suggests that the user you're using to connect to the HANA database does not have sufficient privileges to execute the query. Although your DB Admin claims that the user has all the necessary privileges, there might be some additional steps or configurations required to allow access via pyhdb.

you can try to troubleshoot the issue:

  1. Double-check the user credentials: Make sure that the username and password provided in the connection parameters are correct. Any typos or incorrect credentials can lead to authentication failures.
  2. Verify the user's privileges: Ask your DB Admin to double-check the user's privileges specifically for the _SYS_BIC.LAV_DWH_SELLOUT.CV_NIELSEN view. Even though the user might have general privileges, it's possible that they are missing the required privileges for this specific view.
  3. Check the connection details: Ensure that the hostname, port number, and other connection details provided in the connect function are correct. If any of these details are incorrect, it can result in connection failures.
  4. Confirm pyhdb compatibility: Make sure that your version of pyhdb is compatible with your HANA database version. There could be compatibility issues if the pyhdb version is outdated or not fully compatible with the HANA database version you are using.
  5. Test with a different query: To isolate the issue, try executing a different query that doesn't rely on specific privileges or views. For example, you can try executing a simple SELECT * FROM <table> query on a table that you have confirmed the user has access to. If this query works, it narrows down the issue to the specific privileges on the _SYS_BIC.LAV_DWH_SELLOUT.CV_NIELSEN view.
  6. Check for additional error messages: The error message you provided (insufficient privilege: Not authorized) indicates a lack of privileges, but there might be additional error messages or details that can provide more insights into the issue. Make sure to check the complete error stack trace or any additional error messages that might be available.
If none of these steps resolve the issue, it would be helpful to have more information about your HANA database version, the version of pyhdb you're using, and any additional error messages or stack traces you receive.
buran write Jul-10-2023, 07:08 PM:
Advertisment/spam removed
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020