# -*- coding: utf-8 -*- import sys import io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') from sqlalchemy import create_engine, text conn = create_engine('postgresql://admin:trajet6640@192.168.0.87:5432/apdb_master').connect() print('=== apc 테이블 전체 컬럼 ===\n') result = conn.execute(text(""" SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'apc' ORDER BY ordinal_position """)) for r in result: print(f' {r.column_name}: {r.data_type}') # 안텔민킹 전체 데이터 apc_code = '0230237810109' print(f'\n=== 안텔민킹 ({apc_code}) 전체 데이터 ===\n') result2 = conn.execute(text(f"SELECT * FROM apc WHERE apc = '{apc_code}'")) row = result2.fetchone() if row: cols = result2.keys() for col in cols: val = getattr(row, col) if val: print(f' {col}: {val}') conn.close()