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

setting for db naming convention #123

Closed
guruofgentoo opened this issue Sep 13, 2019 · 0 comments
Closed

setting for db naming convention #123

guruofgentoo opened this issue Sep 13, 2019 · 0 comments
Assignees

Comments

@guruofgentoo
Copy link
Member

SQLAlchemy gives us the option of defining the naming convention for certain constraints. For some databases, like SQL Server, this is essential because the generated constraint names can be difficult to figure out later in migrations.

The difficulty in keg apps at the moment is that assigning that naming convention properly requires a rather invasive modification to app setup. The assignment really has to happen before https://github.com/level12/keg/blob/master/keg/db/__init__.py#L69 runs and loads all the models into metadata. So, we're left with either

  • overriding the db manager class for a simple metadata attribute assignment
  • overriding init_db or init_extensions in the app itself

It would be better to have a setting for naming convention, which could then be applied automatically as something like keg.db.db.metadata.naming_convention = convention. Perhaps tie it to the dialect opts somehow, to support different conventions in the case that multiple dbs are bound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants