peewee 反向生成model
peewee 反向生成model

peewee 反向生成model

(spider) [rhino@rhino014 lxc]$ python -m pwiz -h
Usage: pwiz.py [options] database_name

Options:
  -h, --help            show this help message and exit
  -H HOST, --host=HOST
  -p PORT, --port=PORT
  -u USER, --user=USER
  -P, --password
  -e ENGINE, --engine=ENGINE
                        Database type, e.g. sqlite, mysql, postgresql or
                        cockroachdb. Default is "postgresql".
  -s SCHEMA, --schema=SCHEMA
  -t TABLES, --tables=TABLES
                        Only generate the specified tables. Multiple table
                        names should be separated by commas.
  -v, --views           Generate model classes for VIEWs in addition to
                        tables.
  -i, --info            Add database information and other metadata to top of
                        the generated file.
  -o, --preserve-order  Model definition column ordering matches source table.
  -I, --ignore-unknown  Ignore fields whose type cannot be determined.
  -L, --legacy-naming   Use legacy table- and column-name generation.

注意要点:

  • 不带参数e,默认为postgresql
  • 填写host的时候,得是大写H哦,严格按照help的提示来;
  • 直接运行时打印到控制台,写到文件需要 ... > filename.py

示例代码:

python -m pwiz  -H 192.168.0.14 -p5432 -u postgres -P password -s important_events enterprise_open_information_mobile > filename.py

发表回复

您的电子邮箱地址不会被公开。