Skip to content

Commit

Permalink
adding overlaps to surpress sqlalchemy warnings (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
crooksey authored Oct 21, 2022
1 parent 613adf1 commit b010f8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ziggurat_foundations/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def users_dynamic(self):
""" dynamic relationship for users belonging to this group
one can use filter """
return sa.orm.relationship(
"User", secondary="users_groups", order_by="User.user_name", lazy="dynamic"
"User", secondary="users_groups", order_by="User.user_name", lazy="dynamic", overlaps="groups,users"
)

@declared_attr
Expand Down Expand Up @@ -107,6 +107,7 @@ def resources_dynamic(self):
passive_deletes=True,
passive_updates=True,
lazy="dynamic",
overlaps="owner_group,resources"
)

@sa.orm.validates("permissions")
Expand Down
2 changes: 2 additions & 0 deletions ziggurat_foundations/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def groups(self):
secondary="groups_resources_permissions",
passive_deletes=True,
passive_updates=True,
overlaps="groups,resource_permissions,group_permissions",
)

@declared_attr
Expand All @@ -102,6 +103,7 @@ def users(self):
secondary="users_resources_permissions",
passive_deletes=True,
passive_updates=True,
overlaps="user_permissions"
)

__mapper_args__ = {"polymorphic_on": resource_type}
Expand Down
2 changes: 2 additions & 0 deletions ziggurat_foundations/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def groups_dynamic(self):
lazy="dynamic",
passive_deletes=True,
passive_updates=True,
overlaps="groups,users,users_dynamic"
)

@declared_attr
Expand All @@ -120,6 +121,7 @@ def resource_permissions(self):
cascade="all, delete-orphan",
passive_deletes=True,
passive_updates=True,
overlaps="users"
)

@declared_attr
Expand Down

0 comments on commit b010f8b

Please sign in to comment.