agronholm / agronholm/sqlacodegen

SQLModelGenerator does not respect table names

未关闭
#208 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
2.4k
派生
284
平均合并
2 天 1 小时
30 天内合并 PR
1

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。