This repository was archived by the owner on Feb 22, 2023. It is now read-only.
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Create a wrapper around sqlacodegen to assist developers #15
Open
Description
We are aware that sqlacodegen does not generate perfect models in the following circumstances:
- Primary keys are not present for tables
- Views are represented as simple tables
- Named indexes are not generated correctly
- Issues with plurals
Currently some of these issues are being fixed manually. Ideally we would provide a tool that reports the issues above and the manual work required - or we could go further and automate the fixes for some of these issues.
For 2&3 see comment opencdms-dev/pyopencdms#9 (comment) onwards.
Issues with plurals
ORM classes ending with letter “s” are not generated properly, sqlacodegen uses inflect. See https://stackoverflow.com/a/58010758 and the link to the issue in the inflect library
jaraco/inflect#15 (comment)
Examples from CliDE models:
class StationStatu(Base):
__tablename__ = "station_status"
__table_args__ = {"comment": "Stores allowed values for stations.status_id"}
class StationTimezone(Base):
__tablename__ = "station_timezones"
__table_args__ = {"comment": "Stores time zone that stations can be in."}
Metadata
Metadata
Assignees
Labels
No labels