from sqlalchemy import create_engine from sqlalchemy.sql import text from app.core.config.Config import settings engine = create_engine(settings.COMMERCE_DATABASE_URL) with engine.connect() as conn: res = conn.execute(text("SELECT entity_id, channel, recipient, status, subject FROM notifications ORDER BY created_at DESC LIMIT 10;")).fetchall() for row in res: print(row)