# SqlGenerator **Repository Path**: lllgggccc1024/sql-generator ## Basic Information - **Project Name**: SqlGenerator - **Description**: SQL语句生成器,能够读取Excel中的数据,生成DML SQL语句 - **Primary Language**: Python - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2021-07-21 - **Last Updated**: 2022-10-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SqlGenerator #### 介绍 SQL语句生成器 #### 软件架构 软件架构说明 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) SQL语句生成器 能够从excel文件、Json文件中读取数据,生成SQL Insert语句和建表语句。 特色: 1.适用于MySQL数据库和Oracle数据库; 2.能够根据字段类型对数据进行解析和转换; 3.插入数据时能够对特殊字符进行转义。 Excel的读取模板 ![excel_template](./excel_template.png) 字段类型为空时,默认为VARCHAR。 主键标识为Y时生效,空白或N为不生效。 Json的读取模板在文件中(注意如果有特殊字符格式在Json中也会报错,可以采用json检验工具 https://www.sojson.com/ ) ![json_template](./json_template.png) 代码组织: sqlGeneratorCore.py 定义了表结构信息生成SQL语句的类。 loadXlsxInfo.py定义了读取Excel中的表结构和数据信息的方法。 genInsertSqlFromXlsx.py是读取Excel生成Insert语句的上层代码。 loadJsonInfo.py定义了读取Json中的表结构和数据信息的方法。