前言

Django 反向生成的 model 模型的命令 :  python manager.py inspectdb

SQLAlchemy / Flask-SQLAlchemy则是: pip3 install sqlacodegen

使用方法如下

利用 sqlacodegen 自动生成ORM实体类

..\Anaconda3\envs\py3\Scripts>.\sqlacodegen.exe --outfile project_path\mod.py mysql+pymysql://Username:Password@IP/database_name

善用选项: --help ! usage: sqlacodegen [-h] [--version] [--schema SCHEMA] [--tables TABLES]
[--noviews] [--noindexes] [--noconstraints] [--nojoined]
[--noinflect] [--noclasses] [--outfile OUTFILE]
[url] Generates SQLAlchemy model code from an existing database. positional arguments:
url SQLAlchemy url to the database optional arguments:
-h, --help show this help message and exit # 显示此帮助消息并退出
--version print the version number and exit # 打印版本号并退出
--schema SCHEMA load tables from an alternate schema # 从备用模式加载表
--tables TABLES tables to process (comma-separated, default: all) # 要处理的表(逗号分隔,默认值:全部)
--noviews ignore views # 忽略视图
--noindexes ignore indexes # 忽略索引
--noconstraints ignore constraints # 忽略约束
--nojoined don't autodetect joined table inheritance # 不要自动检测连接表继承
--noinflect don't try to convert tables names to singular form # 不要尝试将表名转换为单数形式
--noclasses don't generate classes, only tables # 不生成类,只生成表
--outfile OUTFILE file to write output to (default: stdout) # 将输出写入的文件(默认值:stdout)

博客搬运地址

  1. 利用sqlacodegen自动生成ORM实体类
  2. Python3 sqlacodegen 根据已有数据库生成 ORM 使用的 model.py

最新文章

  1. 隔天开启tomcat spring报错
  2. thinkphp3.2与phpexcel带图片生成 完美案例
  3. XML特殊符号
  4. 获取 Chromium 源代码以及环境配置
  5. unity3d 的Quaternion.identity和transform.rotation区别是什么
  6. Linux命令之md5sum
  7. Android,visibility属性
  8. 关于java中JButton的样式设置(的一些我们应该知道的函数)(转)
  9. windows系统常见端口和木马默认使用端口
  10. TestNG运作报错An interanl error occurred during:"Launching first"
  11. jsp页面 使用c 标签的 varStatus 属性和 index 解决一行显示多少个 然后进行自动换行
  12. title滚动
  13. JS内置对象学习总结
  14. python3控制语句---选择结构语句
  15. H5测试点总结-UI测试、功能测试、兼容性测试、体验相关(弱网、资源、手机操作等)、安全性测试、性能测试
  16. 编程从入门到放弃(Java)
  17. 目前市场上有些什么样的数据库管理系统(DBMS),它们都有什么特点?它们之间的优缺点有什么?它们的使用场合分别是?
  18. 微信小程序开发学习记录
  19. ping telnet ssh netstat
  20. hibernate中cascade和inverse

热门文章

  1. [WPF自定义控件库]为Form和自定义Window添加FunctionBar
  2. npm 发包
  3. POJ-20407Relatives/NYOJ-333mdd的烦恼,欧拉函数简单应用,模板A
  4. spark streaming 踩过的那些坑
  5. HDU 1016 素数环问题
  6. android开发里跳过的坑——android studio 错误Error:Execution failed for task ':processDebugManifest'. > Manifest merger failed with multiple errors, see logs
  7. javaSctipt基础
  8. POJ 3686_The Windy's
  9. 选择器的使用(nth-of-type和nth-last-of-type选择器)
  10. Windows系统下查看已共享的文件夹的方法