agronholm / agronholm/sqlacodegen

SQLModelGenerator does not respect table names

Offen
#208 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
2.4k
Forks
284
Ø Merge
2 T. 1 Std.
Gemergte PRs (30 T.)
1

Beschreibung

Love the addition of the SQLModelGenerator. However the generated models transform the table names in undesired ways (e.g. `some_random_table` becomes `somerandomtable`).

Removing `render_class_variables` from the SQLModelGenerator class, or simply calling `super().render_class_variables` there fixes the issue. `DeclarativeGenerator.render_class_variables` adds the `__tablename__` class variable, which is supported by SQLModel, see [here](https://github.com/tiangolo/sqlmodel/issues/159#issuecomment-978357069).

I'm happy to open a PR, but I'm not sure if this would have unintended consequences (or if there's a better way to accomplish this).

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.