How to override a column name in sqlalchemy using reflection and descriptive syntax

前端 未结 3 1342
暖寄归人
暖寄归人 2020-12-30 08:40

Hello I\'m trying to port a legacy application to python with sqlalchemy.

The application\'s existing database has about 300 tables and in every table there is a col

3条回答
  •  醉梦人生
    2020-12-30 09:27

    This may be too much brute force, but another approach is to use the sqlacodegen library to auto-generate all the models for your DB, then alter those manually, or tweak sqlacodegen to build the models using your conventions. It has support for mapping reserved words to other symbols.

    See https://pypi.python.org/pypi/sqlacodegen. Nice tool.

提交回复
热议问题