【发布时间】:2021-09-08 21:03:14
【问题描述】:
我需要使用 orm peewee 从我的数据库中的模式内的表创建模型,我找到了一个命令,允许我在 postgresql 中从我的数据库中生成所有模型
python -m pwiz -e postgresql db_name > db_name_models.py
但我只需要创建特定表的模型,该表位于模式内。
【问题讨论】:
标签: python postgresql fastapi peewee
我需要使用 orm peewee 从我的数据库中的模式内的表创建模型,我找到了一个命令,允许我在 postgresql 中从我的数据库中生成所有模型
python -m pwiz -e postgresql db_name > db_name_models.py
但我只需要创建特定表的模型,该表位于模式内。
【问题讨论】:
标签: python postgresql fastapi peewee
您可以使用提供的命令行选项 http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#pwiz
使用 -t 选项提及表格
python -m pwiz -e postgresql db_name -t tablename, tablname2 > db_name_models.py
【讨论】: