Skip to main content

No project description provided

Project description

autosql

一键生成SQL脚本

支持的数据库

Oracle; MySQL; PostgreSQL

支持的操作

建表;建索引;删除表

安装

    pip install autosql

使用

    # test.py
    from autosql import autosql

    obj = autosql.get("path\to\excel\", file_name, dbtype, ifdrop, transform)
    obj.create_table()
    obj.create_index()
    obj.drop_table()

autosql.get()

参数:

  1. path: excel文件路径

  2. file_name: excel文件名

  3. dbtype: 数据库

  4. ifdrop: 是否生成drop语句

  5. transform: 是否进行格式转换

EXCEL格式规范

sheets

  1. 目录

     结构:
     
     中文名 | 表名 | 是否生成脚本 | 日期分区
     测试表 | Test | 1           | 0
    
  2. 索引

     示例:
     表名 | 索引列   | 是否主键 | 是否唯一索引 | 是否有效
     Test | isValid | 0       | 0           | 1
    
  3. Test(表名)

     示例:
     字段     | 含义  | 类型 | 非空 | 默认值 | 键          | 扩展
     id       | 标识 | int  | 是   |        | primary key | auto_increment
     initdate | 时间 | Date | 是   | now()  |             |   
    

函数

表中的函数、数据类型、扩展等都默认为mysql格式,或者你可以自行填写,然后将格式转换设置为False,前提是你确保填写正确

    transform = False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autosql-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file autosql-1.0.0.tar.gz.

File metadata

  • Download URL: autosql-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.0

File hashes

Hashes for autosql-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b53c36e79ee217602f85999ed0a2b852869a4a590168937724b8c661e5f5e159
MD5 f6e15eaf07d141575dddf658fb7d0304
BLAKE2b-256 f4f9e6ed92e6a955b67b2fe8e2be212c11dcdf830beda622a466468bea9d1250

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page