agronholm / agronholm/sqlacodegen

SQLModelGenerator does not respect table names

Abierto
#208 1 comentario 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
2.4k
Forks
284
Merge medio
2 d 1 h
PR fusionados (30 d)
1

Descripción

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).

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.