Easy way to handle database
Project description
简介
light-database 是一个用于简化数据库交互的 Python 包。它支持多种数据库系统,并提供一个易于使用的接口来执行查询和管理数据库。
依赖性
- thrift
- rich
- pandas
- impyla
- mysqlclient
- DBUtils
- portalocker
安装
通过 pip 安装:
conda install -c conda-forge mysqlclient
pip install pandas rich portalocker -i https://mirrors.aliyun.com/pypi/simple/
pip install light-database
快速开始
- 使用 light-database 包初始化项目环境:
from light_database.config import EnvConfig
EnvConfig.write(section="mysql", host=host, port=port, database=database, user=user, password=password)
# EnvConfig.write(section="hive", host=host, port=port, user=user, password=password, auth_mechanism="PLAIN")
# EnvConfig.write(section="hbase", host=host, port=port)
- 使用 light-database 包执行查询:
from light_database.mysql.db import MysqlDB
df1 = MysqlDB.filter(table) \
.select(column1, column2) \
.where(column3__in=[1, 2], column4=1).df()
df2 = MysqlDB.filter(table) \
.select(column1, column2) \
.where(column3__lt=1, column4__ne=1).df[1:2]
功能
- 支持多种数据库系统(如 MySQL、Hive、HBase)
- 简洁的 API
- 连接池管理
- 自动转换查询结果
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file light_database-0.1.2-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: light_database-0.1.2-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d354e179ceb487b9138c122055a2a7d8bc324cc9a2254a117af409a3cd5a267c |
|
MD5 | 84c7e9740605d73768f0dd8e05472299 |
|
BLAKE2b-256 | 5be589fcef8e75bf8ee51bf69691fdd1a7885a270baa7ba265a17a98dc1b4274 |