code: def upgrade():
      bind = op.get_bind()
      session = db.Session(bind=bind)
  
      for slc in session.query(Slice).filter(
          Slice.viz_type.like("directed_force")
      ):
          params = json.loads(slc.params)
          groupby = params.get("groupby", [])
          if groupby:
              params["source"] = groupby[0]
              params["target"] = (
                  groupby[1] if len(groupby) > 1 else None
              )
              del params["groupby"]
  
          params["edgeLength"] = 400
          params["repulsion"] = 1000
          params["layout"] = "force"
  
          if "charge" in params:
              del params["charge"]
          if "collapsed_fieldset" in params:
              del params["collapsed_fieldsets"]
          if "link_length" in params:
              del params["link_length"]
  
          slc.params = json.dumps(params)
          slc.viz_type = "graph_chart"
          session.commit()
      session.close()
  
file_path: superset/superset/migrations/versions/2021-02-14_11-46_1412ec1e5a7b_legacy_force_directed_to_echart.py
imports: import json
  import sqlalchemy
  from alembic import op
  from sqlalchemy import Column, Integer, or_, String, Text
  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() without return types