超品集团自用的Python包
Project description
CPpackage
简介
CPpackage是超品集团内部使用的Python包,核心功能集中在MySQL数据库增删改查功能以及部分数据清洗的能力。
安装
pip install cppackage
使用方法
# 导入包
from CPpackage.db.config import set_db_config
from CPpackage.db.sql_model import sel_data, del_data , incremental_update, get_table_columns,add_columns,check_and_sync_columns,update_datas
#
# 配置数据库连接(也可通过环境变量CPPACKAGE_DB_*配置)
set_db_config(host='your_host', user='your_user', password='your_password', database='your_database', port=3306)
# 更新过程会先经过check_and_sync_columns函数完成表格校验
check_and_sync_columns(df, table_name, database, max_new=5)
# 更新数据函数,在完成数据库信息配置后,df为pd.dataframe格式的数据
update_datas(df, table_name, database)
项目结构
CPpackage/
├── CPpackage/ # 主包
│ ├── core/ # 核心功能
│ ├── utils/ # 工具函数
│ └── db/ # 数据库功能与配置(sql_model拆解于此)
├── manage.py # 管理脚本
├── LICENSE # 许可证
├── MANIFEST.in # 打包配置
├── readme.md # 说明文档
└── setup.py # 安装配置
许可证
本项目采用MIT许可证。详情请参阅LICENSE文件。
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 Distribution
cppackage-0.2.9.tar.gz
(7.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cppackage-0.2.9.tar.gz.
File metadata
- Download URL: cppackage-0.2.9.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30cb940ecc959ebe9da2dad14fb95f2ed9de144e78734eba5a446c0a7f4024bd
|
|
| MD5 |
60cc4559a087b2bc715463b047b1d16c
|
|
| BLAKE2b-256 |
2e03e52efe5f677ee90de28a08fd5ae9d575df7b09bb54f4efb018e7f3c0ee67
|
File details
Details for the file cppackage-0.2.9-py3-none-any.whl.
File metadata
- Download URL: cppackage-0.2.9-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7146c3839842dc7d22b8c34e03ba2e9364966a60a6de4c8ac3e19f99de1f728
|
|
| MD5 |
6322e36b0a29ce08e59cb222022e2704
|
|
| BLAKE2b-256 |
9688d549c2aaf1a74762de770fdb4e7d844c5d735ab64fbf9d62dfc53b916970
|