29 lines
673 B
Python
29 lines
673 B
Python
|
|
from datetime import datetime
|
||
|
|
from sqlalchemy import text
|
||
|
|
from database.connection import sync_engine
|
||
|
|
from utils.logger_config import log_activity
|
||
|
|
|
||
|
|
def update_job_status(table_name: str, status: str, job_id: str = None):
|
||
|
|
query = text("""
|
||
|
|
UPDATE backend.author_metadata
|
||
|
|
SET process = :status,
|
||
|
|
updated_at = :updated_at
|
||
|
|
WHERE table_title = :table_name
|
||
|
|
""")
|
||
|
|
|
||
|
|
params = {
|
||
|
|
"status": status,
|
||
|
|
"updated_at": datetime.utcnow(),
|
||
|
|
"table_name": table_name
|
||
|
|
}
|
||
|
|
|
||
|
|
with sync_engine.begin() as conn:
|
||
|
|
conn.execute(query, params)
|
||
|
|
|
||
|
|
print(f"[DB] Metadata '{table_name}' updated to status '{status}'")
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|