code: def upgrade():
      bind = op.get_bind()
      op.add_column("slices", sa.Column("datasource_id", sa.Integer()))
      session = db.Session(bind=bind)
  
      for slc in session.query(Slice).all():
          if slc.druid_datasource_id:
              slc.datasource_id = slc.druid_datasource_id
          if slc.table_id:
              slc.datasource_id = slc.table_id
          session.commit()
      session.close()
  
file_path: superset/superset/migrations/versions/2016-09-07_23-50_33d996bcc382_update_slice_model.py
imports: import sqlalchemy
  from alembic import op
  from sqlalchemy import Column, Integer, String
  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