Procedures, Tasks and Permissions #101
-
Hi @littleK0i, We're trying to implement our first Procedure and Tasks using SnowDDL and hitting a few permissions issues. We'd like to be able to define a Procedure, probably execute as caller, and call it from a Task, both managed in SnowDDL, but we've found:
Is there a reason not to automatically grant the Schema Owner EXECUTE TASK and/or the necessary Warehouse grant? And wondered what would you recommend to support the the permissions we need in the Procedure - whether we should handle it in programmatic config, or if we could extend the schema owner config to allow global_roles, or something else? Thanks! (fyi @leopasta-enable) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I am currently working on better permission system, which allows setting custom grants for owner / write / read roles. It will be possible to specify and assign "permission models" on per-database and per-schema levels. I expect it to be released in the next few days. In the meantime you may run procedures as "caller" and temporarily remove this line: https://github.com/littleK0i/SnowDDL/blob/master/snowddl/resolver/schema_role.py#L73 It will cause tasks to be created with "SnowDDL admin role" ownership, which naturally has access to all objects it created, including warehouses. Alternatively, I highly suggest to avoid tasks and use proper orchestration tool instead, like Dagster. You'll have much better visibility and control over workflows, including workflows outside of Snowflake. |
Beta Was this translation helpful? Give feedback.
-
@josephniblo , please check latest SnowDDL update v0.27+ Permission model and ownership privileges were substantially extended. Now it is possible to grant account-level privileges and warehouse usage to schema owner roles. https://docs.snowddl.com/basic/yaml-configs/schema For example: owner_warehouse_usage:
- my_task_wh
owner_account_grants:
- EXECUTE TASK This should entirely fix the problem. Make sure to test it in DEV environment, since default permission model was slightly changed. For example, now you may have to specify Full list of potentially breaking changes: https://docs.snowddl.com/breaking-changes-log/0.27.0-may-2024 Now you may also customize permission models for schema roles, if necessary: https://docs.snowddl.com/basic/yaml-configs/permission-model |
Beta Was this translation helpful? Give feedback.
I am currently working on better permission system, which allows setting custom grants for owner / write / read roles. It will be possible to specify and assign "permission models" on per-database and per-schema levels. I expect it to be released in the next few days.
In the meantime you may run procedures as "caller" and temporarily remove this line: https://github.com/littleK0i/SnowDDL/blob/master/snowddl/resolver/schema_role.py#L73
It will cause tasks to be created with "SnowDDL admin role" ownership, which naturally has access to all objects it created, including warehouses.
Alternatively, I highly suggest to avoid tasks and use proper orchestration tool instead, like Dagster. You'll…