Skip to content

Commit

Permalink
Correctly handle case where unpartitioned table does not exist (ansib…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding authored Nov 17, 2023
1 parent f99e210 commit dd63b69
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions awx/api/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@


def unpartitioned_event_horizon(cls):
with connection.cursor() as cursor:
cursor.execute(f"SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE table_name = '_unpartitioned_{cls._meta.db_table}';")
if not cursor.fetchone():
return 0
with connection.cursor() as cursor:
try:
cursor.execute(f'SELECT MAX(id) FROM _unpartitioned_{cls._meta.db_table}')
Expand Down

0 comments on commit dd63b69

Please sign in to comment.