跳转到主要内容

阿姆斯特丹Datapunt postgres表分区模块

项目描述

# pg_partition
用于分区新的/现有的PostgreSQL数据库表的实用程序。数据可以迁移。只支持日期范围分区类型。

必需的环境变量
```
DATABASE_HOST : PostgreSQL服务器的主机名/ip
DATABASE_NAME : 要操作的数据库名称
DATABASE_USER : PostgreSQL登录
DATABASE_PASSWORD : PostgreSQL密码
```

#### 安装 ####
```
pip install -r requirements.txt
```

#### 使用方法 ####
```
用法:pg_partition.py [-h] {create,add} ...

位置参数
{create,add}

可选参数
-h, --help 显示此帮助信息并退出
```

#### 创建用法 ####
```
用法:pg_partition.py create [-h] [--type {day,week,month}] table column

位置参数
table 要分区的表
column 用于范围的列

可选参数
-h, --help 显示此帮助信息并退出
--type {day,week,month}
```

#### 添加用法 ####
```
用法:pg_partition.py add [-h] [--num NUM] [--date DATE]
table {day,week,month}

位置参数
table 要分区的表
{day,week,month}

可选参数
-h, --help 显示此帮助信息并退出
--num NUM 要创建的分区数量
--date DATE 开始日期(yyyymmdd)
```

#### 创建分区 ####
```
# 通过'column'将'table'转换为基于'column'的范围分区表
# 不迁移数据
python pg_partition.py create table column

# 通过'column'将'table'转换为基于'column'的范围分区表
# 数据在周分区中迁移
python pg_partition.py create table column --type week
```

#### 添加分区 ####
```
# 向'table'添加从20180101开始的10个天分区
python pg_partition.py add table day --num 10 --date 20180101

```


项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪一个,请了解更多关于安装包的信息。

源代码分发

datapunt-pg-partitioning-2019.2.27.3.tar.gz (5.5 kB 查看哈希值)

上传时间 源代码

构建分发

datapunt_pg_partitioning-2019.2.27.3-py3-none-any.whl (15.5 kB 查看哈希值)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面