Add in soft failure for sql delete
This commit is contained in:
parent
6cb877d358
commit
c5a708a382
@ -757,6 +757,7 @@ if __name__ == "__main__":
|
|||||||
""")
|
""")
|
||||||
# and prune the DB here if needed.
|
# and prune the DB here if needed.
|
||||||
# Delete existing records for the given date
|
# Delete existing records for the given date
|
||||||
|
try:
|
||||||
delete_query = """
|
delete_query = """
|
||||||
DELETE FROM SummaryLogs
|
DELETE FROM SummaryLogs
|
||||||
WHERE Date = %s
|
WHERE Date = %s
|
||||||
@ -768,6 +769,8 @@ if __name__ == "__main__":
|
|||||||
#quit()
|
#quit()
|
||||||
if rows_deleted > 0:
|
if rows_deleted > 0:
|
||||||
print(f"Deleted {rows_deleted} rows for {analysis_date} ")
|
print(f"Deleted {rows_deleted} rows for {analysis_date} ")
|
||||||
|
except mysql.connector.Error as e:
|
||||||
|
print(f"SQL Delete failed ({delete_query}) ({e}) ")
|
||||||
except mysql.connector.Error as e:
|
except mysql.connector.Error as e:
|
||||||
print(f"Unable to connect to {DBName} on {DBHost} port {DBPort} error ({e}) ")
|
print(f"Unable to connect to {DBName} on {DBHost} port {DBPort} error ({e}) ")
|
||||||
saveData = False
|
saveData = False
|
||||||
|
Loading…
Reference in New Issue
Block a user