From 159dd62d84df3ac14d274571724eee0324c2ca61 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Mon, 25 Sep 2023 18:28:44 -0400 Subject: [PATCH] Add null value handling in create_partition (#14480) --- awx/main/utils/common.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awx/main/utils/common.py b/awx/main/utils/common.py index f653b18e0c..9066707d4d 100644 --- a/awx/main/utils/common.py +++ b/awx/main/utils/common.py @@ -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')