code: def __init__(self, path: str, readonly: bool = False):
      import logging
  
      super().__init__()
      self.path = path
      self.db_url = self.get_db_url(path)
      self.readonly = readonly
      self.engine = create_engine(
          self.db_url,
          echo=(
              logging.INFO
              >= int(os.environ.get(AIM_LOG_LEVEL_KEY, logging.WARNING))
          ),
      )
      self.session_cls = scoped_session(
          sessionmaker(autoflush=False, bind=self.engine)
      )
      self._upgraded = None
  
imports: import os
  from collections import defaultdict
  from weakref import WeakValueDictionary
  from sqlalchemy import create_engine
  from sqlalchemy.orm import sessionmaker, scoped_session
  from aim.storage.migrations.utils import upgrade_database
  from aim.storage.structured.sql_engine.factory import ModelMappedFactory
  from aim.storage.types import SafeNone
  from aim.web.configs import AIM_LOG_LEVEL_KEY
label_desc: Use image node_id 1 to create a new DB object from inherited base classes: ObjectFactory with example: obj = DB(path, readonly)