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 Distributions
File details
Details for the file light_database-0.1.3-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: light_database-0.1.3-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e40e5374b3edd39d130cd5d46221e9b8017d45230d26d13d48d7851f15392b8 |
|
MD5 | f24237a7cc59cc1f6a57296c7227c20a |
|
BLAKE2b-256 | fd1476d53d8b156ae900312ed864b33ec8c0b5cbb1512585627b7e7d34a360c0 |
File details
Details for the file light_database-0.1.3-cp311-cp311-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: light_database-0.1.3-cp311-cp311-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cab387a12e2159058723c9ce1f2bce7a771a8050b86682d57824ac73a2bdbe2 |
|
MD5 | 3a084a670f3407ed9232b9055859d1f8 |
|
BLAKE2b-256 | ac634bbbfe2909f66fde2ea1a5b1d85cd0a4937a93efb99fce96186fe0ca5adc |
File details
Details for the file light_database-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: light_database-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63da5080d7eb5fbd96beb9089d9e575daab609522e9c042a305a16481d20f0ab |
|
MD5 | 42805ea1dbd3f2572a1fafaf97432637 |
|
BLAKE2b-256 | 6b556c4f31b57a54a8bdd47946177bd9fd256c3ec8066329adabe9fffaa4d97d |
File details
Details for the file light_database-0.1.3-cp310-cp310-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: light_database-0.1.3-cp310-cp310-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa344b5e6885abe7ee90094650a8b924e3e144ee6a8fd478de91446b8c4c6758 |
|
MD5 | f1f42f2d051f8463cb19e8c44528ecda |
|
BLAKE2b-256 | 04acbf0b17e779916575db5360cddad0aab3e79ae39cc48a31078e5ee780903e |
File details
Details for the file light_database-0.1.3-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: light_database-0.1.3-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.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68226553c1a1e6ee8662e481292e1ab9184aa945a639231251bd789791a0e6ae |
|
MD5 | 9981ac97941df60486da6ea59613cad4 |
|
BLAKE2b-256 | 4ae1e42cfe48d0c8214d5d9976849377599ec240138a618db93dc6df6f939c28 |