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

Double pluralization of names #262

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
10 changes: 7 additions & 3 deletions src/sqlacodegen/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,9 +1076,13 @@ def generate_relationship_name(
RelationshipType.ONE_TO_MANY,
RelationshipType.MANY_TO_MANY,
):
inflected_name = self.inflect_engine.plural_noun(preferred_name)
if inflected_name:
preferred_name = inflected_name
singular_inflected_name = self.inflect_engine.singular_noun(
preferred_name
)
if singular_inflected_name:
preferred_name = self.inflect_engine.plural_noun(
singular_inflected_name
)
else:
inflected_name = self.inflect_engine.singular_noun(preferred_name)
if inflected_name:
Expand Down