class_docstr: Class used to write data to an assets db.
  
  Parameters
  ----------
  engine : Engine or str
      An SQLAlchemy engine or path to a SQL database.
class_docstr_tok: ["Class","used","to","write","data","to","an","assets","db",".","Parameters","--","--","--","--","--","engine",":","Engine","or","str","An","SQLAlchemy","engine","or","path","to","a","SQL","database","."]
code: def _write_assets(
      self, asset_type, assets, txn, chunk_size, mapping_data=None
  ):
      if asset_type == "future":
          tbl = futures_contracts_table
          if mapping_data is not None:
              raise TypeError("no mapping data expected for futures")
  
      elif asset_type == "equity":
          tbl = equities_table
          if mapping_data is None:
              raise TypeError("mapping data required for equities")
          # write the symbol mapping data.
          self._write_df_to_table(
              equity_symbol_mappings,
              mapping_data,
              txn,
              chunk_size,
          )
  
      else:
          raise ValueError(
              "asset_type must be in {'future', 'equity'}, got: %s"
              % asset_type,
          )
  
      self._write_df_to_table(tbl, assets, txn, chunk_size)
  
      pd.DataFrame(
          {
              asset_router.c.sid.name: assets.index.values,
              asset_router.c.asset_type.name: asset_type,
          }
      ).to_sql(
          asset_router.name,
          txn.connection,
          if_exists="append",
          index=False,
          chunksize=chunk_size,
      )
  
imports: from collections import namedtuple
  import re
  import numpy
  import pandas
  import sqlalchemy
  from toolz import first
  from zipline.errors import AssetDBVersionError
  from zipline.assets.asset_db_schema import ASSET_DB_VERSION, asset_db_table_names, asset_router, equities, equity_symbol_mappings, equity_supplementary_mappings, futures_contracts, exchanges, futures_root_symbols, metadata, version_info
  from zipline.utils.compat import ExitStack
  from zipline.utils.preprocess import preprocess
  from zipline.utils.range import from_tuple, intersecting_ranges
  from zipline.utils.sqlite_utils import coerce_string_to_eng
label_desc: Use image node_id 6 for calling the AssetDBWriter obj's underlying member method code with example usage: obj._write_assets(asset_type, assets, txn, chunk_size, mapping_data) without return types