79824465

Date: 2025-11-19 12:54:05
Score: 0.5
Natty:
Report link

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))
Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Pantea