code: def __init__(self, url: str):
      self.url = url
      self.engine = create_async_engine(self.url, echo=False)
      self.session_maker = sessionmaker(
          bind=self.engine, expire_on_commit=False, class_=AsyncSession
      )
  
      @event.listens_for(self.engine.sync_engine, "connect")
      def set_sqlite_pragma(
          dbapi_connection: DBAPIConnection, _: ConnectionPoolEntry
      ):
          cursor = dbapi_connection.cursor()
          cursor.execute("PRAGMA journal_mode=WAL;")
          cursor.execute("PRAGMA foreign_keys=ON;")
          cursor.execute("PRAGMA busy_timeout=5000;")
          cursor.close()
  
file_path: dstack/src/dstack/_internal/server/db.py
imports: from contextlib import asynccontextmanager
  from alembic import command, config
  from sqlalchemy import event
  from sqlalchemy.engine.interfaces import DBAPIConnection
  from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
  from sqlalchemy.orm import sessionmaker
  from sqlalchemy.pool import ConnectionPoolEntry
  from dstack._internal.server import settings
  from dstack._internal.server.settings import DATABASE_URL
label_desc: Use image node_id 1 to create a new Database object  with example: obj = Database(url)