mysql-partition库-创建数据库表分区、展示表分区最新字段

说明[tips]

提供mysql数据库的分区表最新分区查询,支持分区字段为DATE或TO_DAYS(date_str)类型的数据表新建分区,依赖库包括:"pandas", "pymysql", "sqlalchemy".

[Provide the latest partition query for the partition table of MySQL database, supporting partition fields of DATE or TO_ Create new partitions for DAYS (date str) type data tables, with dependency libraries including "pandas", "pymysql", and "sqlalchemy".]

安装[install]

pip install mysql-partition

使用[use] 在使用之前请准备好数据库连接字典db_info

[Please prepare the database connection dictionary db_info before use.] d

b_info = { "host": "127.0.0.1", "port": 3306, "username": "root", "password": "lytcreate", "database": "yt_zz" }

1.获取指定数据库所有分区表的表名及最新分区

[Obtain the table names and latest partitions of all partition tables in the specified database.]

import mysql_partition res = mysql_partition.show(db_info) // return mysql partition dict.

2.创建指定数据库的所有分区表至指定分区日期,不指定日期则默认为执行当天[Create all partition tables for the specified database until the specified partition date. If no date is specified, it defaults to the execution day.]

import mysql_partition

mysql_partition.create(db_info, "2023-01-01") // Create all partition tables until January 1, 2023

pypi地址:https://pypi.org/project/mysql-partition/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lytcreate.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值