Skip to main content

description

这是第一个对外发布的模块,基于pymysql1.1.0进行的封装。
功能:报错后自动关闭sql连接,py编写sql更友好。

参数解析:

config: 配置对象,用于连接数据库
sql: sql语句
args:用的pymysql里面的args【type: list or tuple】
db_name:数据库名称
table_name:表名称
size:每次查询的条数

配置对象

config = {
    'host': '192.168.93.131',  # 必传
    'port': 3306,  # 可选参数
    'user': 'root',  # 必传参数
    'password': 'Tomboy_test',  # 必传参数
    'db': 'test',  # 可选参数
}

功能

1.DML合并:
    都是changeRows方法
    params:
        sql:sql语句
        args:用来替换sql语句中的%s的参数
    return:
        受影响的行数或者None,只有rows>0才会被commit

2.查询合并:
    查询所有:
        mydb.queryRows(sql, args)
    查询一条:
        mydb.queryOneRow(sql, args, size=1)
    查询前n条:
        mydb.queryManyRows(sql, args, size=n)

3.报错后自动回滚 + 断开数据库连接,回收资源

Release files for mydb-tsm 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mydb-tsm 1.0.1
File Size Uploaded
mydb_tsm-1.0.1.tar.gz 4.6 kB Details

Release files / mydb_tsm-1.0.1.tar.gz

Download URL mydb_tsm-1.0.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9667ce1c6262a99c085c7ae4d9b741108159fc8ad100dca49baf8f7ed3fc6e5e
BLAKE2b-256 checksum
How to use checksums
f085cc20f5aa6f993744541c675cb56d14f9cb3597c4f1d0b44ceeba22447f80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page