Skip to main content

EaseMySQL

一个简单易用的MySQL封装库,帮助开发者更高效地处理MySQL数据库操作。

主要功能

  • 数据库连接池管理
  • 简化的CRUD操作接口
  • SQL语句构建辅助函数
  • 支持参数化查询,防止SQL注入
  • 单例模式确保每个连接配置只创建一个连接池

安装方法

pip install --upgrade easemysql -i https://pypi.org/simple/

依赖的库

pip install pymysql --upgrade
pip install DBUtils --upgrade

快速开始

from easemysql import EaseMySQL

# 配置数据库连接
config = dict(host='localhost', user='username', password='password', database='dbname')
db = EaseMySQL(**config)

# 查询单条记录
result = db.one('table_name', dict(id=1))

# 查询多条记录
results = db.all('table_name', 'status = ?', [1])

# 使用条件列表进行复杂查询
results = db.all('table_name', [
    'or',
    ['in', 'id', [1, 3, 4]],
    ['and', ['>', 'id', 5], 'id < 8', dict(id=[6, 7])],
    dict(id=8),
    dict(id=[9]),
])

# 插入记录
db.insert('table_name', dict(name='test', value=123))

# 更新记录
db.update('table_name', dict(value=456), 'id = 1')

# 删除记录
db.delete('table_name', 'id = 1')

Metadata

Release files for easemysql 1.3.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 easemysql 1.3.1
File Size Uploaded Provenance Actions
easemysql-1.3.1.tar.gz 15.9 kB Without provenance Details for easemysql-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for easemysql 1.3.1
File Interpreter ABI Platform Actions
easemysql-1.3.1-py3-none-any.whl Python 3 none any Details for easemysql-1.3.1-py3-none-any.whl

Total release size: 31.6 kB

Release files / easemysql-1.3.1.tar.gz

Download URL easemysql-1.3.1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d0ccad7c7b08ab9f997982561eaa9e16e5a65d3fcc7292cc324eaef6d9dc649e
BLAKE2b-256 checksum
How to use checksums
5cd93855c209eb8a775ed46f83444ad260c163580f8db9635e08f97c546fcd70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / easemysql-1.3.1-py3-none-any.whl

Download URL easemysql-1.3.1-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
693a91d807dad6a482b5a8fab428ac3bc6a668ed8c881d426dc7fd5ad7f1e2aa
BLAKE2b-256 checksum
How to use checksums
cdca1df082277112da2f75b26ec1b907ec3a0d78b014e82671d6354c4e6b5637
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Security for easemysql 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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