-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SNOW-218] Create proxy admin database role (#131)
* Create proxy admin database role * Grant proxy admin role ownership of *ALL_ADMIN roles * Transfer ownership of current and future internamespace objects * address PR comments * bump version to avoid conflict * grant execute managed task privilege to proxy admin
- Loading branch information
1 parent
890f1ac
commit caeb547
Showing
8 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
admin/future_grants/V1.6.4__internamespace_object_ownership_dev.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Grant future ownership of object types which potentially need | ||
-- internamespace privileges to proxy admin database role. | ||
-- SYNAPSE | ||
GRANT OWNERSHIP | ||
ON FUTURE DYNAMIC TABLES | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN; | ||
|
||
-- SYNAPSE_RAW | ||
GRANT OWNERSHIP | ||
ON FUTURE TASKS | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE_RAW | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN; |
13 changes: 13 additions & 0 deletions
13
admin/future_grants/V1.6.5__internamespace_object_ownership_prod.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Grant future ownership of object types which potentially need | ||
-- internamespace privileges to proxy admin database role. | ||
-- SYNAPSE | ||
GRANT OWNERSHIP | ||
ON FUTURE DYNAMIC TABLES | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE.SYNAPSE | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN; | ||
|
||
-- SYNAPSE_RAW | ||
GRANT OWNERSHIP | ||
ON FUTURE TASKS | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE.SYNAPSE_RAW | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- Grant the proxy admin database role ownership and usage | ||
-- of the `*ALL_ADMIN` database roles. | ||
GRANT OWNERSHIP | ||
ON DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE_ALL_ADMIN | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
GRANT OWNERSHIP | ||
ON DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE_RAW_ALL_ADMIN | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
GRANT OWNERSHIP | ||
ON DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.SCHEMACHANGE_ALL_ADMIN | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
|
||
GRANT DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE_ALL_ADMIN | ||
TO ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN; | ||
GRANT DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE_RAW_ALL_ADMIN | ||
TO ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN; | ||
GRANT DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.SCHEMACHANGE_ALL_ADMIN | ||
TO ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- Grant the proxy admin database role ownership and usage | ||
-- of the `*ALL_ADMIN` database roles. | ||
GRANT OWNERSHIP | ||
ON DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.SYNAPSE_ALL_ADMIN | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
GRANT OWNERSHIP | ||
ON DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.SYNAPSE_RAW_ALL_ADMIN | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
GRANT OWNERSHIP | ||
ON DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.SCHEMACHANGE_ALL_ADMIN | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
|
||
GRANT DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.SYNAPSE_ALL_ADMIN | ||
TO ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN; | ||
GRANT DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.SYNAPSE_RAW_ALL_ADMIN | ||
TO ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN; | ||
GRANT DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.SCHEMACHANGE_ALL_ADMIN | ||
TO ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN; |
14 changes: 14 additions & 0 deletions
14
admin/ownership_grants/V1.6.2__internamespace_object_ownership_dev.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Grant ownership of internamespace objects to proxy admin database role | ||
-- SYNAPSE | ||
GRANT OWNERSHIP | ||
ON ALL DYNAMIC TABLES | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
|
||
-- SYNAPSE_RAW | ||
GRANT OWNERSHIP | ||
ON ALL TASKS | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE_DEV.SYNAPSE_RAW | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE_DEV.ALL_ADMIN | ||
COPY CURRENT GRANTS; |
14 changes: 14 additions & 0 deletions
14
admin/ownership_grants/V1.6.3__internamespace_object_ownership_prod.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Grant ownership of internamespace objects to proxy admin database role | ||
-- SYNAPSE | ||
GRANT OWNERSHIP | ||
ON ALL DYNAMIC TABLES | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE.SYNAPSE | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN | ||
COPY CURRENT GRANTS; | ||
|
||
-- SYNAPSE_RAW | ||
GRANT OWNERSHIP | ||
ON ALL TASKS | ||
IN SCHEMA SYNAPSE_DATA_WAREHOUSE.SYNAPSE_RAW | ||
TO DATABASE ROLE SYNAPSE_DATA_WAREHOUSE.ALL_ADMIN | ||
COPY CURRENT GRANTS; |
13 changes: 13 additions & 0 deletions
13
synapse_data_warehouse/database_roles/V2.39.0__proxy_admin_role.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
USE DATABASE {{ database_name }}; --noqa: JJ01,PRS,TMP | ||
|
||
-- Create proxy admin database role which will own the `*ALL_ADMIN` roles | ||
CREATE OR REPLACE DATABASE ROLE ALL_ADMIN; | ||
|
||
-- Grant ownership of the proxy admin database role to the database admin | ||
GRANT OWNERSHIP | ||
ON DATABASE ROLE ALL_ADMIN | ||
TO ROLE {{ database_name }}_ADMIN; --noqa: JJ01,PRS,TMP | ||
|
||
-- Grant proxy admin role to the database admin account role | ||
GRANT DATABASE ROLE ALL_ADMIN | ||
TO ROLE {{ database_name }}_ADMIN; --noqa: JJ01,PRS,TMP |