code: def _export(
      model: SavedQuery, export_related: bool = True
  ) -> Iterator[tuple[str, str]]:
      # build filename based on database, optional schema, and label
      database_slug = secure_filename(model.database.database_name)
      schema_slug = secure_filename(model.schema)
      query_slug = secure_filename(model.label) or str(model.uuid)
      file_name = (
          f"queries/{database_slug}/{schema_slug}/{query_slug}.yaml"
      )
  
      payload = model.export_to_dict(
          recursive=False,
          include_parent_ref=False,
          include_defaults=True,
          export_uuids=True,
      )
      payload["version"] = EXPORT_VERSION
      payload["database_uuid"] = str(model.database.uuid)
  
      file_content = yaml.safe_dump(payload, sort_keys=False)
      yield file_name, file_content
  
      # include database as well
      if export_related:
          file_name = f"databases/{database_slug}.yaml"
  
          payload = model.database.export_to_dict(
              recursive=False,
              include_parent_ref=False,
              include_defaults=True,
              export_uuids=True,
          )
          # TODO (betodealmeida): move this logic to export_to_dict once this
          # becomes the default export endpoint
          if "extra" in payload:
              try:
                  payload["extra"] = json.loads(payload["extra"])
              except json.decoder.JSONDecodeError:
                  logger.info(
                      "Unable to decode `extra` field: %s",
                      payload["extra"],
                  )
  
          payload["version"] = EXPORT_VERSION
  
          file_content = yaml.safe_dump(payload, sort_keys=False)
          yield file_name, file_content
  
file_path: superset/superset/commands/query/export.py
imports: import json
  import logging
  from collections.abc import Iterator
  import yaml
  from werkzeug.utils import secure_filename
  from superset.commands.export.models import ExportModelsCommand
  from superset.models.sql_lab import SavedQuery
  from superset.commands.query.exceptions import SavedQueryNotFoundError
  from superset.daos.query import SavedQueryDAO
  from superset.utils.dict_import_export import EXPORT_VERSION
label_desc: Use image node_id 1 for calling the ExportSavedQueriesCommand obj's underlying member method code with example usage: obj._export(model, export_related) without return types