Automated Action 2681892abd Add Weather Data API with OpenWeatherMap integration
- Set up FastAPI project structure
- Create database models for locations and weather data
- Implement OpenWeatherMap API integration
- Create API endpoints for current weather and history
- Add health endpoint
- Set up database migrations with Alembic
- Update README with documentation

generated with BackendIM... (backend.im)
2025-05-12 13:35:49 +00:00

21 lines
482 B
Python

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_engine(
settings.SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()