SQLAlchemy 反向生成 model 模型
2024-08-30 20:06:46
前言
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)
博客搬运地址
最新文章
- 隔天开启tomcat spring报错
- thinkphp3.2与phpexcel带图片生成 完美案例
- XML特殊符号
- 获取 Chromium 源代码以及环境配置
- unity3d 的Quaternion.identity和transform.rotation区别是什么
- Linux命令之md5sum
- Android,visibility属性
- 关于java中JButton的样式设置(的一些我们应该知道的函数)(转)
- windows系统常见端口和木马默认使用端口
- TestNG运作报错An interanl error occurred during:";Launching first";
- jsp页面 使用c 标签的 varStatus 属性和 index 解决一行显示多少个 然后进行自动换行
- title滚动
- JS内置对象学习总结
- python3控制语句---选择结构语句
- H5测试点总结-UI测试、功能测试、兼容性测试、体验相关(弱网、资源、手机操作等)、安全性测试、性能测试
- 编程从入门到放弃(Java)
- 目前市场上有些什么样的数据库管理系统(DBMS),它们都有什么特点?它们之间的优缺点有什么?它们的使用场合分别是?
- 微信小程序开发学习记录
- ping telnet ssh netstat
- hibernate中cascade和inverse
热门文章
- [WPF自定义控件库]为Form和自定义Window添加FunctionBar
- npm 发包
- POJ-20407Relatives/NYOJ-333mdd的烦恼,欧拉函数简单应用,模板A
- spark streaming 踩过的那些坑
- HDU 1016 素数环问题
- android开发里跳过的坑——android studio 错误Error:Execution failed for task ':processDebugManifest'. >; Manifest merger failed with multiple errors, see logs
- javaSctipt基础
- POJ 3686_The Windy's
- 选择器的使用(nth-of-type和nth-last-of-type选择器)
- Windows系统下查看已共享的文件夹的方法