Skip to main content

Add your description here

Project description

vidbcontrol

一个可以进行数据验证的服务器配置信息库

安装

pip install vidbcontrol

使用

生成sql语句

    # 示例使用
    table = Query("name", "public")

    try:
        sql, params = table.select(**{
            "columns": ["name AS username", "age AS userage"],
            "where": {
                "and": {
                    "name=": ["zhoubin", "zhangsan"],  # 支持列表
                    "or": {
                        "age>": 20,
                        "age<": 10
                    },
                    "age BETWEEN": [18, 30]
                }
            },
            "orderby": "name",
            "limit": 1
        })
        print("SQL 语句:", sql)
        print("参数列表:", params)

        sql, params = table.insert({"name":  "test", "age": 20})
        print("SQL 语句:", sql)
        print("参数列表:", params)

        sql, params = table.insert_mul(**{
            "columns": ["name", "age"],
            "data": [
                ["zhoubin", 28],
                ["zhangsan", 30]
            ]
        })
        print("SQL 语句:", sql)
        print("参数列表:", params)

        sql, params = table.update({"name":  "test", "age": 20}, {"name=":  "test", "age=": 20})
        print("SQL 语句:", sql)
        print("参数列表:", params)

        sql, params = table.delete({"name=":  "test", "age=": 20})
        print("SQL 语句:", sql)
        print("参数列表:", params)
    except DBException as e:
        print(f"数据库异常: {e}")

依赖库

  • psycopg2

版权说明

该项目签署了MIT 授权许可。详细请查看LICENSE

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

vidbcontrol-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vidbcontrol-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file vidbcontrol-0.1.0.tar.gz.

File metadata

  • Download URL: vidbcontrol-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for vidbcontrol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 96acf0b640593448f161183d1df742b4d3bde041de25ef3415b64e87391d3850
MD5 c34f913ddddd57fe963f0675c6e6f43a
BLAKE2b-256 f04c949400e51be9458ab7ebc1d446d64f3260cec2f53ecccaf2bc2b709c4404

See more details on using hashes here.

File details

Details for the file vidbcontrol-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vidbcontrol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c49f281411df9218cff794068cbe6b597d3dc6db4088a3e59d722026cce60c29
MD5 075b0c11814586cbdfd5aff88cf69a5d
BLAKE2b-256 1b0f7c80d541394f50ae4ad6223bcf7ae2bc76e244cde42d02bf869fa9deaaf1

See more details on using hashes here.

Supported by

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