Skip to content

Instantly share code, notes, and snippets.

View tenapril's full-sized avatar
😎
Data Plumber with interest in IOT and Pipelining

Andrew Tirto K tenapril

😎
Data Plumber with interest in IOT and Pipelining
View GitHub Profile
@tenapril
tenapril / README.md
Last active January 27, 2024 19:21
Postgres Partitioned Table Monthly Script DDL Generator

Postgres Partitioned Table Monthly Script DDL Generator

USING PYTHON3

  1. this script was created based on this
  2. writing a DDL for every single table is time consuming so i created this script, this script's purpose is to create a monthly postgres partitioned table based on the date
  3. this will create a partitioned table with name like child_table_y2020m01

Parameters

  1. filename is filename
  2. months_back is how many months behind you want for the partitioned table
  3. months_front is how many months ahead you want for the partitioned table