The backend component to interface with the smart contract.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

27 rindas
642 B

  1. from sqlalchemy.ext.declarative import declarative_base
  2. from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
  3. from sqlalchemy.orm import sessionmaker
  4. from sqlalchemy.ext.asyncio import AsyncSession
  5. from app.core.config import settings
  6. # Create async engine
  7. engine = create_async_engine(
  8. settings.DATABASE_URL,
  9. pool_pre_ping=True,
  10. pool_size=10,
  11. max_overflow=20
  12. )
  13. # Create a custom session class
  14. AsyncSessionLocal = sessionmaker(
  15. engine,
  16. class_=AsyncSession,
  17. expire_on_commit=False,
  18. autocommit=False,
  19. autoflush=False
  20. )
  21. # Create a base class for declarative models
  22. Base = declarative_base()