code: def upgrade_slc(slc: Slice) -> None:
      # clean up all charts with datasource_type not != table
      slc.datasource_type = "table"
      ds_id = None
      ds_type = None
      try:
          params_dict = json.loads(slc.params)
          ds_id, ds_type = params_dict["datasource"].split("__")
          # the assumption here is that the query was saved as a dataset
          # but the type wasn't written properly to the slice
          # by updating the type here we expect it will either work
          # or it will 404 when the dataset is looked up.
          params_dict["datasource"] = f"{ds_id}__table"
          slc.params = json.dumps(params_dict)
          logger.warning(
              "updated slice datasource from %s__%s to %s__table for slice: %s",
              ds_id,
              ds_type,
              ds_id,
              slc.id,
          )
      except Exception:
          # skip any malformatted params
          logger.warning(
              "failed to update slice.id = %s w/ datasource = %s__%s to %s__table",
              slc.id,
              ds_id,
              ds_type,
              ds_id,
          )
          pass
  
file_path: superset/superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
imports: import json
  import logging
  import sqlalchemy
  from alembic import op
  from sqlalchemy.ext.declarative import declarative_base
  from superset import db
label_desc: Use image node_id 1 for calling a global function with example usage: upgrade_slc(slc) without return types