cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Databricks Free Trial Help
Engage in discussions about the Databricks Free Trial within the Databricks Community. Share insights, tips, and best practices for getting started, troubleshooting issues, and maximizing the value of your trial experience to explore Databricks' capabilities effectively.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

User does not have SELECT on Table

VenT
New Contributor

Hello,

I am trying the Databricks free edition and I used the Build your first AI agent template.
I want to save the responses from the chat into a table in the database and I made sure my user hasALL PRIVILEGES assigned for the <catalog>.<schema>.<table-name> that I'm using.
I added a code that saves the messages into the ChatAgent's predict method:

df = spark.createDataFrame([content_dicts] if isinstance(content_dicts, dict) else content_dicts)

CATALOG_NAME = "workspace"
SCHEMA_NAME = "default"
        
df.write.mode("append").saveAsTable(f"{CATALOG_NAME}.{SCHEMA_NAME}.responses")

 If I run the agent from the notebook - it works and the table is updated, but if I deploy the agent and try to generate some responses - I receive an error "User does not have SELECT on Table"
I even tried using the databricks SDK to update the permissions runtime:

x = w.grants.update(
    full_name="workspace.default.responses",
    securable_type="TABLE",
    changes=[
        catalog.PermissionsChange(
            add=[catalog.Privilege.ALL_PRIVILEGES],
            principal=account_level_group_name,
        )
    ],
)

No success. 

I also updated the catalog permissions and granted ALL not only to my user, but to the admin, users and all workspace users groups.

I have only one warehouse - the default serverless that comes with the Free account.
I tried passing warehouse Id to the deployment config(to make sure the serving uses the same database where I have correct permissions):
Also tried updating the default warehouse to be the same.

from databricks import agents

deployment_info = agents.deploy(
    model_name=registered_model_name,
    model_version=logged_agent_info.registered_model_version,
    scale_to_zero=True,
    warehouse_id="53047a8915d49294"
)

 

1 REPLY 1

szymon_dybczak
Esteemed Contributor III

Hi @VenT ,

Which authentication are you using?  Assuming you're using automatic authentication passthrough you need to declare resource dependencies when logging the agent, and Databricks automatically provisions, rotates, and manages short-lived credentials when the agent is deployed.

Log and register AI agents - Azure Databricks | Microsoft Learn

Authentication for AI agents - Azure Databricks | Microsoft Learn