In many use cases, maintaining high availability for database objects is crucial. This is particularly important when models created in one project are referenced as sources in other projects. Or if there are other applications trying to access database objects while they are getting rebuilt in a pipeline.
However, when a pipeline runs, there is often a gap between table recreation and applying the grants. During this interim period, any applications attempting to access the tables might encounter an error such as:
Object <DB.SCHEMA.TABLE> does not exist or not authorized.
To overcome this issue, you can set the copy_grants
config on your MATE project. This setting applies the "copy grants" DDL qualifier whenever tables and views are rebuilt.
An example project dbt_project.yml
file:
name: my_project
models:
+copy_grants: true
my_project:
...
This feature ensures that permissions are seamlessly transferred from the old to the new table, eliminating temporary downtime and preserving access continuity.
It’s important to note, however, that copy_grants
does not revoke grants from the configuration.