def METHOD_NAME():
    bind = op.get_bind()
    session = db.Session(bind=bind)
    for chart in session.query(Slice):
        params = json.loads(chart.params or "{}")
        if not params.get("num_period_compare"):
            continue
        num_period_compare = int(params.get("num_period_compare"))
        granularity = (
            params.get("granularity")
            if chart.datasource_type == "druid"
            else params.get("time_grain_sqla")
        )
        time_compare = compute_time_compare(granularity, num_period_compare)
        period_ratio_type = params.get("period_ratio_type") or "growth"
        comparison_type = comparison_type_map[period_ratio_type.lower()]
        params["time_compare"] = [time_compare]
        params["comparison_type"] = comparison_type
        chart.params = json.dumps(params, sort_keys=True)
    session.commit()
    session.close()