2121class Base (Base_ ):
2222 __abstract__ = True
2323
24- schemas = Schemas ().are ("bar" )
24+ schemas = Schemas ().are ("bar" , "baz" )
2525 roles = Roles (ignore_unspecified = True ).are ("access" , "noaccess" )
2626 grants = Grants ().are (
2727 DefaultGrant .on_tables_in_schema ("bar" ).grant ("select" , to = "access" ),
28+ DefaultGrant .on_tables_in_schema ("baz" ).grant ("select" , to = "access" ),
2829 DefaultGrant .on_tables_in_schema ("bar" ).grant ("select" , to = "noaccess" ),
29- Grant .new ("usage" , to = "access" ).on_schemas ("bar" ),
30+ Grant .new ("usage" , to = "access" ).on_schemas ("bar" , "baz" ),
3031 )
3132
3233
@@ -37,6 +38,13 @@ class Bar(Base):
3738 id = Column (types .Integer (), autoincrement = True , primary_key = True )
3839
3940
41+ class Baz (Base ):
42+ __tablename__ = "baz"
43+ __table_args__ = {"schema" : "baz" }
44+
45+ id = Column (types .Integer (), autoincrement = True , primary_key = True )
46+
47+
4048pg = create_postgres_fixture (scope = "function" , engine_kwargs = {"echo" : True })
4149
4250
@@ -61,3 +69,6 @@ def test_createall_grant(pg):
6169 # There should be no diffs detected after running `create_all`
6270 diff = compare_grants (pg , grants , roles )
6371 assert len (diff ) == 0
72+
73+ # Ensure we're exploding common grants.
74+ pg .execute (text ("SET ROLE access; SELECT * from baz.baz" ))
0 commit comments