summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Rominger <arominge@redhat.com>2023-09-26 00:28:44 +0200
committerGitHub <noreply@github.com>2023-09-26 00:28:44 +0200
commit159dd62d84df3ac14d274571724eee0324c2ca61 (patch)
tree868f6db8bfff8550046e7e19ac3dac72ca1c0bdf
parentRemoved references of IRC and fixed formatting in "Work Items" section. (#14478) (diff)
downloadawx-159dd62d84df3ac14d274571724eee0324c2ca61.tar.xz
awx-159dd62d84df3ac14d274571724eee0324c2ca61.zip
Add null value handling in create_partition (#14480)
-rw-r--r--awx/main/utils/common.py5
1 files 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')