自动映射sql表并生成用于orm操作的类
orm-creator的Python项目详细描述
说明
映射sql(mysql)表并自动生成orm类!啊! 这被证明是非常有用的,尤其是在表的数量很大的情况下
演示
从命令行
作为python模块
安装
使用此存储库
git clone http://github.com/shravan97/ORM-Creator
cd ORM-Creator
python setup.py install
使用pip
马上就来!
用法
usage: orm-creator [-h][-db DB][-t TABLES [TABLES ...]][-host HOST][-u UNAME][-o OUTFILE] optional arguments: -h, --help show this help message and exit -db DB The name of database from which tables will have to mapped -t TABLES [TABLES ...] List of table names each separated by one or more space -host HOST Name of the MySql host For Eg., localhost , mysql.mydomain.com ,....etc -u UNAME Your Mysql username -o OUTFILE Output file name ,along with its extension and absolute path For Eg. , /home/shravan97/Desktop/out.py
样品
作为命令行应用程序
orm-creator -u root -db demo -t users migrations -o /var/www/flaskApp/db.py
# The above statement maps `users` and `migrations` tables
作为模块
fromorm_creatorimportormCreatoroc=ormCreator(config,'demo',['users','migrations'],'/var/www/flaskApp/db.py')# config is stored as a dict . For eg. , config = {'uname':'root','password':'**','host':'localhost'}oc.generate_file()
请检查here
贡献
有什么好主意可以在这里实现吗?继续做一个拉动请求:微笑:! 你不妨把它作为一个问题来提出来here
贡献者
许可证
GNU通用公共许可v3(GPLV3)