from app.core.database import engine
from sqlalchemy import text

tables = ['invoices', 'sales', 'payments']
with engine.connect() as conn:
    for tbl in tables:
        rows = conn.execute(text(
            f"SELECT column_name FROM information_schema.columns WHERE table_name='{tbl}' ORDER BY ordinal_position"
        ))
        cols = [r[0] for r in rows]
        print(f"--- {tbl} ({len(cols)}) ---")
        print(cols)
        print()
