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

Stop double pluralization of names #260

Open
1 task done
jensenbox opened this issue Mar 20, 2023 · 0 comments · May be fixed by #262
Open
1 task done

Stop double pluralization of names #260

jensenbox opened this issue Mar 20, 2023 · 0 comments · May be fixed by #262

Comments

@jensenbox
Copy link

jensenbox commented Mar 20, 2023

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

Most of the tables I am working with come from ActiveRecord where the relationship names are pluralized. In the current implementation a plural_noun of the already plural name like users ends up with a name like userss instead of users.

The easy fix is to first convert it to a singular name then pluralize like:

                    singular_inflected_name = self.inflect_engine.singular_noun(preferred_name)
                    inflected_name = self.inflect_engine.plural_noun(singular_inflected_name)

This came from around line 1000 in the generators.py

An option for "singularize" or perhaps to not use inflect on relationship names could work too. In my case first converting to singular worked well.

Use case

When you are generating models from ActiveRecord implementations.

sqlacodegen --version
3.0.0rc2
@dkratzert dkratzert linked a pull request Mar 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant