Hey Databricks community,
We are registering views in Databricks with schema evolution, however these views fail when a user (other than the owner) is the first to query the view after the schema change.
PERMISSION_DENIED: User is not an owner of Table '<domain>.<schema>.<view>'.
I had a look in the access log and it appears that if someone queries the view after a schema change, the view definition (columns) is updated. This update action can only be performed by the owner of the view and hence if any other user queries the view, the above error is thrown.
I was wondering if someone already encountered this error and found a solution
Example code leading to the error
create table <catalog>.<schema>.<table> location '<external storage location>'
create view <catalog>.<schema>.<view> with schema evolution as select * from <catalog>.<schema>.<table>
# <-- Make any schema change to the delta table in the external location
Select * from <catalog>.<schema>.<view> # Perform this query with another identity than the one creating the table