Buckets:
AnonymousSpottedToad/human_verified_bucket / codebase /python /cemde_WhatsNext /whatsnext /api /server /database.py
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import declarative_base, sessionmaker | |
| from .config import db | |
| SQLALCHEMY_DATABASE_URL = f"postgresql://{db.user}:{db.password}@{db.hostname}:{db.port}/{db.database}" | |
| # Configure connection pool for production use | |
| engine = create_engine( | |
| SQLALCHEMY_DATABASE_URL, | |
| pool_size=5, # Number of connections to keep in the pool | |
| max_overflow=10, # Max additional connections beyond pool_size | |
| pool_pre_ping=True, # Verify connections are alive before using | |
| pool_recycle=3600, # Recycle connections after 1 hour to prevent stale connections | |
| ) | |
| SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
| Base = declarative_base() | |
| def get_db(): | |
| db = SessionLocal() | |
| try: | |
| yield db | |
| finally: | |
| db.close() | |
Xet Storage Details
- Size:
- 816 Bytes
- Xet hash:
- 171e7be65db9ebe1a6c61630f81c32f0a5a3e36770d652cff6bdc06e3cfdb4a6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.