agronholm / agronholm/sqlacodegen

SQLModelGenerator does not respect table names

Đang mở
#208 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
2.4k
Fork
284
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.