class_docstr: Import charts
code: def _import(
      session: Session, configs: dict[str, Any], overwrite: bool = False
  ) -> None:
      # discover datasets associated with charts
      dataset_uuids: set[str] = set()
      for file_name, config in configs.items():
          if file_name.startswith("charts/"):
              dataset_uuids.add(config["dataset_uuid"])
  
      # discover databases associated with datasets
      database_uuids: set[str] = set()
      for file_name, config in configs.items():
          if (
              file_name.startswith("datasets/")
              and config["uuid"] in dataset_uuids
          ):
              database_uuids.add(config["database_uuid"])
  
      # import related databases
      database_ids: dict[str, int] = {}
      for file_name, config in configs.items():
          if (
              file_name.startswith("databases/")
              and config["uuid"] in database_uuids
          ):
              database = import_database(
                  session, config, overwrite=False
              )
              database_ids[str(database.uuid)] = database.id
  
      # import datasets with the correct parent ref
      datasets: dict[str, SqlaTable] = {}
      for file_name, config in configs.items():
          if (
              file_name.startswith("datasets/")
              and config["database_uuid"] in database_ids
          ):
              config["database_id"] = database_ids[
                  config["database_uuid"]
              ]
              dataset = import_dataset(session, config, overwrite=False)
              datasets[str(dataset.uuid)] = dataset
  
      # import charts with the correct parent ref
      for file_name, config in configs.items():
          if (
              file_name.startswith("charts/")
              and config["dataset_uuid"] in datasets
          ):
              # update datasource id, type, and name
              dataset = datasets[config["dataset_uuid"]]
              config.update(
                  {
                      "datasource_id": dataset.id,
                      "datasource_type": "table",
                      "datasource_name": dataset.table_name,
                  }
              )
              config["params"].update({"datasource": dataset.uid})
  
              if "query_context" in config:
                  config["query_context"] = None
  
              import_chart(session, config, overwrite=overwrite)
  
file_path: superset/superset/commands/chart/importers/v1/__init__.py
imports: from typing import Any
  from marshmallow import Schema
  from sqlalchemy.orm import Session
  from superset.charts.schemas import ImportV1ChartSchema
  from superset.commands.chart.exceptions import ChartImportError
  from superset.commands.chart.importers.v1.utils import import_chart
  from superset.commands.database.importers.v1.utils import import_database
  from superset.commands.dataset.importers.v1.utils import import_dataset
  from superset.commands.importers.v1 import ImportModelsCommand
  from superset.connectors.sqla.models import SqlaTable
  from superset.daos.chart import ChartDAO
  from superset.databases.schemas import ImportV1DatabaseSchema
  from superset.datasets.schemas import ImportV1DatasetSchema
label_desc: Use image node_id 1 for calling the ImportChartsCommand obj's underlying member method code with example usage: obj._import(session, configs, overwrite) without return types