mirror of
https://github.com/ansible/awx.git
synced 2026-03-25 12:55:04 -02:30
Correctly handle case where unpartitioned table does not exist (#14648)
This commit is contained in:
@@ -128,6 +128,10 @@ logger = logging.getLogger('awx.api.views')
|
|||||||
|
|
||||||
|
|
||||||
def unpartitioned_event_horizon(cls):
|
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:
|
with connection.cursor() as cursor:
|
||||||
try:
|
try:
|
||||||
cursor.execute(f'SELECT MAX(id) FROM _unpartitioned_{cls._meta.db_table}')
|
cursor.execute(f'SELECT MAX(id) FROM _unpartitioned_{cls._meta.db_table}')
|
||||||
|
|||||||
Reference in New Issue
Block a user