kdrug-inventory-system/dev_scripts/check_purchase_tables.py
시골약사 ad9ac396e2 chore: 개발 파일 정리 및 구조화
- 개발/테스트 스크립트를 dev_scripts/ 폴더로 이동
- 스크린샷을 screenshots/ 폴더로 이동
- 백업 파일 보존 (.backup)
- 처방 관련 추가 스크립트 포함

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-18 04:44:48 +00:00

35 lines
974 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sqlite3
conn = sqlite3.connect('database/kdrug.db')
cursor = conn.cursor()
# 테이블 목록 확인
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name")
tables = cursor.fetchall()
print("=== 전체 테이블 목록 ===")
for table in tables:
print(f" - {table[0]}")
print("\n=== inventory_lots 테이블 구조 ===")
cursor.execute("PRAGMA table_info(inventory_lots)")
columns = cursor.fetchall()
for col in columns:
print(f" {col[1]}: {col[2]}")
print("\n=== inventory_lots 샘플 데이터 ===")
cursor.execute("""
SELECT lot_id, lot_number, herb_item_id, quantity_onhand,
unit_price_per_g, received_date, receipt_id
FROM inventory_lots
WHERE is_depleted = 0
LIMIT 5
""")
rows = cursor.fetchall()
for row in rows:
print(f" LOT {row[0]}: {row[1]}, 재고:{row[3]}g, 단가:₩{row[4]}, 입고일:{row[5]}, receipt_id:{row[6]}")
conn.close()