mirror of https://github.com/apache/superset.git
Adds the migration processor
This commit is contained in:
parent
85a22f27aa
commit
a69e9deb95
|
@ -33,6 +33,7 @@ class VizType(str, Enum):
|
||||||
HISTOGRAM = "histogram"
|
HISTOGRAM = "histogram"
|
||||||
LINE = "line"
|
LINE = "line"
|
||||||
PIVOT_TABLE = "pivot_table"
|
PIVOT_TABLE = "pivot_table"
|
||||||
|
SANKEY = "sankey"
|
||||||
SUNBURST = "sunburst"
|
SUNBURST = "sunburst"
|
||||||
TREEMAP = "treemap"
|
TREEMAP = "treemap"
|
||||||
|
|
||||||
|
@ -89,6 +90,7 @@ def migrate(viz_type: VizType, is_downgrade: bool = False) -> None:
|
||||||
MigrateHistogramChart,
|
MigrateHistogramChart,
|
||||||
MigrateLineChart,
|
MigrateLineChart,
|
||||||
MigratePivotTable,
|
MigratePivotTable,
|
||||||
|
MigrateSankey,
|
||||||
MigrateSunburst,
|
MigrateSunburst,
|
||||||
MigrateTreeMap,
|
MigrateTreeMap,
|
||||||
)
|
)
|
||||||
|
@ -103,6 +105,7 @@ def migrate(viz_type: VizType, is_downgrade: bool = False) -> None:
|
||||||
VizType.HISTOGRAM: MigrateHistogramChart,
|
VizType.HISTOGRAM: MigrateHistogramChart,
|
||||||
VizType.LINE: MigrateLineChart,
|
VizType.LINE: MigrateLineChart,
|
||||||
VizType.PIVOT_TABLE: MigratePivotTable,
|
VizType.PIVOT_TABLE: MigratePivotTable,
|
||||||
|
VizType.SANKEY: MigrateSankey,
|
||||||
VizType.SUNBURST: MigrateSunburst,
|
VizType.SUNBURST: MigrateSunburst,
|
||||||
VizType.TREEMAP: MigrateTreeMap,
|
VizType.TREEMAP: MigrateTreeMap,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
slice_name: Sankey
|
slice_name: Sankey
|
||||||
description: null
|
description: null
|
||||||
certified_by: null
|
certified_by: null
|
||||||
|
|
|
@ -303,3 +303,15 @@ class MigrateHistogramChart(MigrateViz):
|
||||||
groupby = self.data.get("groupby")
|
groupby = self.data.get("groupby")
|
||||||
if not groupby:
|
if not groupby:
|
||||||
self.data["groupby"] = []
|
self.data["groupby"] = []
|
||||||
|
|
||||||
|
|
||||||
|
class MigrateSankey(MigrateViz):
|
||||||
|
source_viz_type = "sankey"
|
||||||
|
target_viz_type = "sankey_v2"
|
||||||
|
remove_keys = {"groupby"}
|
||||||
|
|
||||||
|
def _pre_action(self) -> None:
|
||||||
|
groupby = self.data.get("groupby")
|
||||||
|
if groupby and len(groupby) > 1:
|
||||||
|
self.data["source"] = groupby[0]
|
||||||
|
self.data["target"] = groupby[1]
|
||||||
|
|
Loading…
Reference in New Issue