Create partition only if it doesn't exist

This commit is contained in:
Jim Ladd 2021-02-19 14:57:12 -08:00
parent 0c289205de
commit 445042c0f4

View File

@ -1047,7 +1047,7 @@ def create_partition(start, end=None, partition_label=None):
#):
for tblname in ('main_jobevent',):
cursor.execute(
f'CREATE TABLE {tblname}_{partition_label} '
f'CREATE TABLE IF NOT EXISTS {tblname}_{partition_label} '
f'PARTITION OF {tblname} '
f'FOR VALUES FROM (\'{start_timestamp}\') to (\'{end_timestamp}\');'
)