Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

adding overlaps to suppress sqlalchemy warnings #72

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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