sqlmesh
sqlmesh copied to clipboard
Fetch Current Schema and Table for Granting Permissions in Post-Hooks
As a data transformer, I would like to be able to grant permissions when new schemas and tables are created. For example, I have a role in Postgres called data_consumer_admin.
Regardless of the plan being executed, I would like the data_consumer_admin to be able to access the newly created schemas and tables. For example, to review MRs/PRs, I share an example of the data processed. Every data_consumer_admin should be able to query from this SQLMesh environment.
This runs, but marts is not replaced with marts__dev or whatever the current plan's environment is.
@IF(
@runtime_stage = 'creating',
GRANT USAGE ON SCHEMA marts TO group_data_consumer_admin
);
From Slack discussion here: https://tobiko-data.slack.com/archives/C044BRE5W4S/p1722431705430829