Great thanks.
what about this piece of code:
try:
# 1. Set is_running=1
oracle_cursor.execute("""
update running_etl_table
set is_running = 1
where upper(table_name) = 'CREDIT_PURCHASES'
""")
oracleDB.commit()
# 2. Do the actual work
# <your ETL code here>
except Exception as e:
print("--------------------An error occurred:", str(e))
sys.exit(1) # mark job as failed
finally:
# 3. ALWAYS set is_running=0 regardless of success or failure
try:
oracle_cursor.execute("""
update running_etl_table
set is_running = 0
where upper(table_name) = 'CREDIT_PURCHASES'
""")
oracleDB.commit()
print("is_running reset to 0")
except Exception as inner_e:
print("Failed to reset is_running flag!:", str(inner_e))