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
Close
Hashes for datapunt-pg-partitioning-2019.2.27.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6a72546a7446681d95226c2c9bba47a794f372aa4923a1be2a5d1e785403484 |
|
MD5 | 1f4aa19039ed8db5e35c3f269807f51d |
|
BLAKE2b-256 | 82baf29f2b30d095556664ab8b79b51bce55271f831fc6b29aa8f45470f3c5bb |
Close
Hashes for datapunt_pg_partitioning-2019.2.27-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd432b7aa18ba95eca9bede3a149ba9e1354f81b214366f1b3c02b17f6d29fd7 |
|
MD5 | bd92b700d2724c520b6faea8fbb952b5 |
|
BLAKE2b-256 | 6fd29c33cbf90ca01c531b05d05e7aa25436c1f60b560d8b46e641c044a64677 |