code: def _upgrade_db(engine):
      """
      Upgrade the schema of an MLflow tracking database to the latest supported version.
      Note that schema migrations can be slow and are not guaranteed to be transactional -
      we recommend taking a backup of your database before running migrations.
  
      :param url Database URL, like sqlite:///<absolute-path-to-local-db-file>. See
      https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls for a full list of valid
      database URLs.
      """
      # alembic adds significant import time, so we import it lazily
      from alembic import command
  
      db_url = str(engine.url)
      _logger.info("Updating database tables")
      config = _get_alembic_config(db_url)
      # Initialize a shared connection to be used for the database upgrade, ensuring that
      # any connection-dependent state (e.g., the state of an in-memory database) is preserved
      # for reference by the upgrade routine. For more information, see
      # https://alembic.sqlalchemy.org/en/latest/cookbook.html#sharing-a-
      # connection-with-a-series-of-migration-commands-and-environments
      with engine.begin() as connection:
          config.attributes["connection"] = connection
          command.upgrade(config, "heads")
  
imports: import logging
  import os
  import time
  from contextlib import contextmanager
  import sqlalchemy
  from alembic.migration import MigrationContext
  from alembic.script import ScriptDirectory
  from sqlalchemy import sql
  from sqlalchemy.pool import AssertionPool, AsyncAdaptedQueuePool, FallbackAsyncAdaptedQueuePool, NullPool, QueuePool, SingletonThreadPool, StaticPool
  from mlflow.environment_variables import MLFLOW_SQLALCHEMYSTORE_ECHO, MLFLOW_SQLALCHEMYSTORE_MAX_OVERFLOW, MLFLOW_SQLALCHEMYSTORE_POOL_RECYCLE, MLFLOW_SQLALCHEMYSTORE_POOL_SIZE, MLFLOW_SQLALCHEMYSTORE_POOLCLASS
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import BAD_REQUEST, INTERNAL_ERROR, TEMPORARILY_UNAVAILABLE
  from mlflow.store.db.db_types import SQLITE
  from mlflow.store.model_registry.dbmodels.models import SqlModelVersion, SqlModelVersionTag, SqlRegisteredModel, SqlRegisteredModelAlias, SqlRegisteredModelTag
  from mlflow.store.tracking.dbmodels.initial_models import Base
  from mlflow.store.tracking.dbmodels.models import SqlDataset, SqlExperiment, SqlExperimentTag, SqlInput, SqlInputTag, SqlLatestMetric, SqlMetric, SqlParam, SqlRun, SqlTag
label_desc: Use image node_id 8 for calling a global function with example usage: _upgrade_db(engine) without return types