17 lines
525 B
Python
17 lines
525 B
Python
def get_last_processed_read_id(cur, engine_table: str):
|
|
sql = f"SELECT last_processed_read_id FROM `{engine_table}` WHERE id = 1"
|
|
cur.execute(sql)
|
|
row = cur.fetchone()
|
|
return int(row["last_processed_read_id"]) if row else None
|
|
|
|
|
|
def update_last_processed_read_id(cur, cnx, engine_table: str, new_value: int):
|
|
sql = f"""
|
|
UPDATE `{engine_table}`
|
|
SET last_processed_read_id = %s,
|
|
updated_at = NOW()
|
|
WHERE id = 1
|
|
"""
|
|
cur.execute(sql, (new_value,))
|
|
cnx.commit()
|