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"
)