Future ownerships are not perfect future ownerships
Describe the bug
roles:
- loader
owns:
schemas:
- raw.*
tables:
- raw.*.*
If your spec files contain future ownership like above, it does not change the ownership for future ones.
Steps To Reproduce
Append the future ownership like as above in your spec file and run.
Current behavior
The permifrost tool is granting ownership to existing schemas, tables, and views.
GRANT OWNERSHIP ON schema raw.schema_a TO ROLE loader COPY CURRENT GRANTS;
GRANT OWNERSHIP ON schema raw.schema_b TO ROLE loader COPY CURRENT GRANTS;
GRANT OWNERSHIP ON table raw.schema_a.table_a TO ROLE loader COPY CURRENT GRANTS;
GRANT OWNERSHIP ON view raw.schema_b.view_a TO ROLE loader COPY CURRENT GRANTS;
Expected behavior
The permifrost tool should grant ownership to existing and future schemas, tables, and views.
GRANT OWNERSHIP ON schema raw.schema_a TO ROLE loader COPY CURRENT GRANTS;
GRANT OWNERSHIP ON schema raw.schema_b TO ROLE loader COPY CURRENT GRANTS;
GRANT OWNERSHIP ON table raw.schema_a.table_a TO ROLE loader COPY CURRENT GRANTS;
GRANT OWNERSHIP ON view raw.schema_b.view_a TO ROLE loader COPY CURRENT GRANTS;
REVOKE OWNERSHIP ON FUTURE SCHEMAS IN database raw FROM ROLE transformer; -- (Only if, ownership is already granted)
GRANT OWNERSHIP ON FUTURE SCHEMAS IN database raw TO ROLE loader;
REVOKE OWNERSHIP ON FUTURE TABLES IN database raw FROM ROLE transformer; -- (Only if, ownership is already granted)
GRANT OWNERSHIP ON FUTURE TABLES IN database raw TO ROLE loader;
REVOKE OWNERSHIP ON FUTURE VIEWS IN database raw FROM ROLE transformer; -- (Only if, ownership is already granted)
GRANT OWNERSHIP ON FUTURE VIEWS IN database raw TO ROLE loader;
Screenshots and log output
The output of permifrost --version
:
permifrost, version 0.12.1
The operating system you're using:
MacOS Big Sur 11.6
The output of python --version
:
Python 3.9.6
Additional context
Add any other context about the problem here.
Edited by Sumit Rai