Add null value handling in create_partition (#14480)

This commit is contained in:
Alan Rominger 2023-09-25 18:28:44 -04:00 committed by GitHub
parent 640e5db9c6
commit 159dd62d84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1164,8 +1164,9 @@ def create_partition(tblname, start=None):
try:
with transaction.atomic():
with connection.cursor() as cursor:
r_tuples = cursor.execute(f"SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = '{tblname}_{partition_label}');")
for row in r_tuples: # should only have 1
cursor.execute(f"SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = '{tblname}_{partition_label}');")
row = cursor.fetchone()
if row is not None:
for val in row: # should only have 1
if val is True:
logger.debug(f'Event partition table {tblname}_{partition_label} already exists')