Hi @vmpmreistad, It appears that the issue you're facing is a known behaviour in Databricks when you execute a CREATE OR REPLACE VIEW
statement on an existing view. This action overwrites the existing view definition, including any previously granted permissions on the view.
This behaviour is not a bug but rather a limitation of the CREATE OR REPLACE VIEW
statement in Databricks.
To work around this limitation and preserve existing grants on the view, you can use the ALTER VIEW
statement instead of CREATE OR REPLACE VIEW
. The ALTER VIEW
statement allows you to modify the existing view without removing any previously granted permissions.
Here's how you can use ALTER VIEW
to modify the view while preserving existing grants:
%sql
-- Grant permissions on the view if necessary
GRANT SELECT ON bronze.default.test_access_view TO user1
-- Alter the view
ALTER VIEW bronze.default.test_access_view
AS
SELECT 1 as one;
By employing the ALTER VIEW
statement in place of CREATE OR REPLACE VIEW
, you can modify the view without losing any previously granted permissions.