# -*- coding: utf-8 -*-
from sqlalchemy import create_engine, text

engine = create_engine('postgresql://admin:trajet6640@192.168.0.87:5432/apdb_master')
with engine.connect() as conn:
    result = conn.execute(text("""
        SELECT apc, product_name, 
               llm_pharm->>'체중/부위' as dosage,
               llm_pharm->>'주성분' as ingredient
        FROM apc 
        WHERE product_name ILIKE '%티어가드%'
        ORDER BY apc
    """))
    
    print('=== PostgreSQL 티어가드 전체 규격 ===')
    for row in result:
        print(f'APC: {row.apc}')
        print(f'  제품명: {row.product_name}')
        print(f'  용량: {row.dosage}')
        print(f'  성분: {row.ingredient}')
        print()
