Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix to pgbedrock to recognize partitioned tables as objects #1

Merged

Conversation

FlipEnergy
Copy link
Member

@FlipEnergy FlipEnergy commented Sep 1, 2022

  • add test as well
  • fixes to keep tests working
  • bumps version to 0.4.3

Latest run (note no changes to ticket since I've manually added permissions from before but it no longer crashes)

--------------------------------                                                                                                                                     
--- Configuring memberships ----                                                                                                                                     
--------------------------------                                                                                                                                     
                                                                                                                                                                     
-- Skipping membership configuration for superuser "cybertec"                                                                                                        
-- Skipping membership configuration for superuser "postgres"                                                                                                        
                                                                                                                                                                     
                                                                                                                                                                     
--------------------------------                                                                                                                                     
--- Configuring ownerships -----                                                                                                                                     
--------------------------------                                                                                                                                     
                                                                                                                                                                     
                                                                                                                                                                     
                                                                                                                                                                     
--------------------------------                                                                                                                                     
--- Configuring privileges -----                                                                                                                                     
--------------------------------                                                                                                                                     
                                                                                                                                                                     
GRANT SELECT ON TABLE public."ticket" TO "admin";                                                                                                                    
GRANT DELETE ON TABLE public."ticket" TO "admin";                                                                                                                    
GRANT INSERT ON TABLE public."ticket" TO "admin";                                                                                                                    
GRANT REFERENCES ON TABLE public."ticket" TO "admin";                                                                                                                
GRANT TRIGGER ON TABLE public."ticket" TO "admin";                                                                                                                   
GRANT TRUNCATE ON TABLE public."ticket" TO "admin";                                                                                                                  
GRANT UPDATE ON TABLE public."ticket" TO "admin";                                                                                                                    
GRANT SELECT ON TABLE public."ticket" TO "analytics";                                                                                                                
REVOKE SELECT ON TABLE public."ticket_old" FROM "analytics";                                                                                                         
-- Skipping privilege configuration for superuser "cybertec"                                                                                                         
GRANT SELECT ON TABLE public."ticket" TO "datadog";                                                                                                                  
REVOKE SELECT ON TABLE public."ticket_old" FROM "datadog";                                                                                                           
GRANT SELECT ON TABLE public."ticket" TO "debezium";                                                                                                                 
REVOKE SELECT ON TABLE public."ticket_old" FROM "debezium";                                                                                                          
GRANT SELECT ON TABLE public."ticket" TO "developer";                                                                                                                
REVOKE SELECT ON TABLE public."ticket_old" FROM "developer";                                                                                                         
GRANT DELETE ON TABLE public."ticket" TO "developer";                                                                                                                
GRANT INSERT ON TABLE public."ticket" TO "developer";                                                                                                                
GRANT REFERENCES ON TABLE public."ticket" TO "developer";                                                                                                            
GRANT TRIGGER ON TABLE public."ticket" TO "developer";                                                                                                               
GRANT TRUNCATE ON TABLE public."ticket" TO "developer";                                                                                                              
GRANT UPDATE ON TABLE public."ticket" TO "developer";                                                                                                                
REVOKE DELETE ON TABLE public."ticket_old" FROM "developer";                                                                                                         
REVOKE INSERT ON TABLE public."ticket_old" FROM "developer";                                                                                                         
REVOKE REFERENCES ON TABLE public."ticket_old" FROM "developer";                                                                                                     
REVOKE TRIGGER ON TABLE public."ticket_old" FROM "developer";                                                                                                        
REVOKE TRUNCATE ON TABLE public."ticket_old" FROM "developer";                                                                                                       
REVOKE UPDATE ON TABLE public."ticket_old" FROM "developer";                                                                                                         
-- Skipping privilege configuration for superuser "postgres"   

@linear
Copy link

linear bot commented Sep 1, 2022

PLTSR-998 Patch pgbedrock to work with partitioned table

Currently pgbedrock cannot find a partitioned table object and fails on it when it is explicitly listed for roles like debezium, analytics, and developer.

I've given them the right privileges with GRANT directly for now but we should fix pgbedrock.

@FlipEnergy FlipEnergy requested a review from a team September 1, 2022 22:43
@FlipEnergy FlipEnergy marked this pull request as ready for review September 1, 2022 22:43
Copy link

@JordanP JordanP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one question

@@ -2,3 +2,4 @@ pytest==3.1.3
pytest-cov==2.5.1
-r requirements-docs.txt
wheel==0.33.6
psycopg2==2.7.7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this old version of psycopg2 specifically ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the existing tests fail due to a parameter change with psycopg2 2.8.x

@FlipEnergy FlipEnergy requested a review from a team September 2, 2022 17:03
@FlipEnergy FlipEnergy merged commit ac450e9 into master Sep 2, 2022
@FlipEnergy FlipEnergy deleted the dennis/pltsr-998-patch-pgbedrock-to-work-with-partitioned branch September 2, 2022 17:04
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants