Datapunt Amsterdam postgres table partitioning module
Project description
# pg_partition
Utility to partition new/existing PostgreSql database tables. Data can be migrated. Only date range partition type is supported.
Required environment variables:
```
DATABASE_HOST : hostname/ip of the PostgreSql server
DATABASE_NAME : database to operate on
DATABASE_USER : PostgreSql login
DATABASE_PASSWORD : PostgreSql password
```
#### Install ####
```
pip install -r requirements.txt
```
#### Usage ####
```
usage: pg_partition.py [-h] {create,add} ...
positional arguments:
{create,add}
optional arguments:
-h, --help show this help message and exit
```
#### Create Usage ####
```
usage: pg_partition.py create [-h] [--type {day,week,month}] table column
positional arguments:
table table to be partitioned
column column to be used for range
optional arguments:
-h, --help show this help message and exit
--type {day,week,month}
```
#### Add Usage ####
```
usage: pg_partition.py add [-h] [--num NUM] [--date DATE]
table {day,week,month}
positional arguments:
table table to be partitioned
{day,week,month}
optional arguments:
-h, --help show this help message and exit
--num NUM partitions to create
--date DATE start date (yyyymmdd)
```
#### Creating partitions ####
```
# Convert 'table' to a range partitioned table by 'column'
# No data is migrated
python pg_partition.py create table column
# Convert 'table' to a range partitioned table by 'column'
# Data is migrated in week partitions
python pg_partition.py create table column --type week
```
#### Adding partitions ####
```
# Adds 10 day partitions starting from 20180101 to 'table'
python pg_partition.py add table day --num 10 --date 20180101
```
Utility to partition new/existing PostgreSql database tables. Data can be migrated. Only date range partition type is supported.
Required environment variables:
```
DATABASE_HOST : hostname/ip of the PostgreSql server
DATABASE_NAME : database to operate on
DATABASE_USER : PostgreSql login
DATABASE_PASSWORD : PostgreSql password
```
#### Install ####
```
pip install -r requirements.txt
```
#### Usage ####
```
usage: pg_partition.py [-h] {create,add} ...
positional arguments:
{create,add}
optional arguments:
-h, --help show this help message and exit
```
#### Create Usage ####
```
usage: pg_partition.py create [-h] [--type {day,week,month}] table column
positional arguments:
table table to be partitioned
column column to be used for range
optional arguments:
-h, --help show this help message and exit
--type {day,week,month}
```
#### Add Usage ####
```
usage: pg_partition.py add [-h] [--num NUM] [--date DATE]
table {day,week,month}
positional arguments:
table table to be partitioned
{day,week,month}
optional arguments:
-h, --help show this help message and exit
--num NUM partitions to create
--date DATE start date (yyyymmdd)
```
#### Creating partitions ####
```
# Convert 'table' to a range partitioned table by 'column'
# No data is migrated
python pg_partition.py create table column
# Convert 'table' to a range partitioned table by 'column'
# Data is migrated in week partitions
python pg_partition.py create table column --type week
```
#### Adding partitions ####
```
# Adds 10 day partitions starting from 20180101 to 'table'
python pg_partition.py add table day --num 10 --date 20180101
```
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
Built Distribution
File details
Details for the file datapunt-pg-partitioning-2019.2.27.2.tar.gz
.
File metadata
- Download URL: datapunt-pg-partitioning-2019.2.27.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54f029859bff77fb0fe68da835817e260bc4c5098f5503fb17a15147fe603abc |
|
MD5 | 1b4a23783d30cf875767e4b9bcca6feb |
|
BLAKE2b-256 | fec5e1636862af926326fae1f10438850262f184d83f241b8c47e48f97737fdf |
File details
Details for the file datapunt_pg_partitioning-2019.2.27.2-py3-none-any.whl
.
File metadata
- Download URL: datapunt_pg_partitioning-2019.2.27.2-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a61c0469217dc40b31ca32e0f54e7b45daefc9cf426508fe9720dc88e2a0432 |
|
MD5 | 289c1805c7221593271da4b763659623 |
|
BLAKE2b-256 | 212e64b67e8e2dc4ecd176218662519e338598ae910800343ac08968be660ded |