2026-01-27 02:52:02 +00:00
|
|
|
from datetime import datetime
|
|
|
|
|
from sqlalchemy import text
|
2026-02-10 01:54:35 +00:00
|
|
|
from database.connection import engine
|
2026-01-27 02:52:02 +00:00
|
|
|
from utils.logger_config import log_activity
|
|
|
|
|
|
2026-02-10 01:54:35 +00:00
|
|
|
async def update_job_status(table_name: str, status: str, job_id: str = None):
|
2026-01-27 02:52:02 +00:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-10 01:54:35 +00:00
|
|
|
async with engine.begin() as conn:
|
|
|
|
|
await conn.execute(query, params)
|
2026-01-27 02:52:02 +00:00
|
|
|
|
2026-02-10 01:54:35 +00:00
|
|
|
print(f"[DB] Metadata '{table_name}' updated to status '{status}'")
|