code: def upgrade():
      bind = op.get_bind()
      session = db.Session(bind=bind)
  
      for slc in session.query(Slice).all():
          try:
              params = json.loads(slc.params)
  
              for key in ("filters", "having_filters", "extra_filters"):
                  value = params.get(key)
  
                  # Remove empty in/not-in filters.
                  if value:
                      params[key] = [
                          x
                          for x in value
                          if not (
                              x["op"] in ("in", "not in")
                              and not x["val"]
                          )
                      ]
  
              slc.params = json.dumps(params, sort_keys=True)
          except Exception:
              pass
  
      session.commit()
      session.close()
  
file_path: superset/superset/migrations/versions/2018-06-07_09-52_afb7730f6a9c_remove_empty_filters.py
imports: import json
  from alembic import op
  from sqlalchemy import Column, Integer, 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