code: def _pragma_foreign_keys(connection, on):
      """Sets the PRAGMA foreign_keys state of the SQLite database. Disabling
      the pragma allows for batch modification of tables with foreign keys.
  
      Parameters
      ----------
      connection : Connection
          A SQLAlchemy connection to the db
      on : bool
          If true, PRAGMA foreign_keys will be set to ON. Otherwise, the PRAGMA
          foreign_keys will be set to OFF.
      """
      connection.execute(
          "PRAGMA foreign_keys=%s" % ("ON" if on else "OFF")
      )
  
file_path: catalyst/catalyst/assets/asset_db_migrations.py
imports: from functools import wraps
  from alembic.migration import MigrationContext
  from alembic.operations import Operations
  import sqlalchemy
  from toolz.curried import do, operator
  from catalyst.assets.asset_writer import write_version_info
  from catalyst.errors import AssetDBImpossibleDowngrade
  from catalyst.utils.preprocess import preprocess
  from catalyst.utils.sqlite_utils import coerce_string_to_eng
label_desc: Use image node_id 2 for calling a global function with example usage: _pragma_foreign_keys(connection, on) without return types