Files
Source/project/STOCK_APP/backend/repository/db_init.py
T
cooney 315105cebb 랭그래프 활용한 주식 정보 도출 프로젝트
- 투자 의견 조회
ㄴ 전반적인 주식 판단 기준(ex. 채무, 리스크 등등)을 기준으로 판단하여 도출
- 투자 추천
ex)
{
  "tickers": [
    "NVDA", "GOOGL", "AAPL"
  ],
  "risk_type": "aggressive"
}
2026-06-19 18:03:05 +09:00

23 lines
591 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import DeclarativeBase, sessionmaker
from pathlib import Path
Path("db").mkdir(parents=True, exist_ok=True)
# echo sql 구문 출력시키는
engine = create_engine('sqlite:///db/stock.db', echo=True)
# 세션 팩토리 생성
SessionLocal = sessionmaker(bind=engine, autoflush=False, autocommit=False)
# Base = declarative_Base()
class Base(DeclarativeBase):
pass
# session 을 다른 모듈에서 사용할 수 있도록 제공
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()