Files
plantillas-proyectos/backend/inspect_schema.py

21 lines
637 B
Python

from sqlalchemy import create_engine, text
# Connect to DB (adjust for localhost)
DB_URL = "postgresql://postgres:postgres@localhost:5432/anexo76_core"
engine = create_engine(DB_URL)
sql = """
SELECT column_name, data_type, character_maximum_length
FROM information_schema.columns
WHERE table_name = 'company' AND table_schema = 'a76'
AND column_name IN ('has_express_line', 'is_service_company');
"""
try:
with engine.connect() as conn:
result = conn.execute(text(sql))
for row in result:
print(f"Column: {row[0]}, Type: {row[1]}, Length: {row[2]}")
except Exception as e:
print(f"Error: {e}")