mirror of https://github.com/apache/superset.git
fix: Viz migration adjustments - 1 (#24341)
This commit is contained in:
parent
9adb023880
commit
4e47771df1
|
@ -25,6 +25,7 @@ from sqlalchemy import and_, Column, Integer, String, Text
|
|||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from superset import conf, db, is_feature_enabled
|
||||
from superset.constants import TimeGrain
|
||||
from superset.migrations.shared.utils import paginated_update, try_load_json
|
||||
|
||||
Base = declarative_base()
|
||||
|
@ -95,6 +96,7 @@ class MigrateViz:
|
|||
|
||||
if self.has_x_axis_control:
|
||||
rv_data["x_axis"] = granularity_sqla
|
||||
rv_data["time_grain_sqla"] = rv_data.get("time_grain_sqla") or TimeGrain.DAY
|
||||
|
||||
temporal_filter = {
|
||||
"clause": "WHERE",
|
||||
|
|
|
@ -80,13 +80,15 @@ class MigratePivotTable(MigrateViz):
|
|||
def _pre_action(self) -> None:
|
||||
if pivot_margins := self.data.get("pivot_margins"):
|
||||
self.data["colTotals"] = pivot_margins
|
||||
self.data["rowTotals"] = pivot_margins
|
||||
|
||||
if pandas_aggfunc := self.data.get("pandas_aggfunc"):
|
||||
self.data["pandas_aggfunc"] = self.aggregation_mapping[pandas_aggfunc]
|
||||
|
||||
self.data["rowOrder"] = "value_z_to_a"
|
||||
|
||||
|
||||
class MigrateDualLine(MigrateViz):
|
||||
has_x_axis_control = True
|
||||
source_viz_type = "dual_line"
|
||||
target_viz_type = "mixed_timeseries"
|
||||
rename_keys = {
|
||||
|
|
|
@ -45,7 +45,7 @@ TARGET_FORM_DATA = {
|
|||
"granularity_sqla": "ds",
|
||||
"groupbyColumns": ["state"],
|
||||
"groupbyRows": ["name"],
|
||||
"rowTotals": True,
|
||||
"rowOrder": "value_z_to_a",
|
||||
"series_limit_metric": "count",
|
||||
"time_range": "100 years ago : now",
|
||||
"transposePivot": True,
|
||||
|
|
Loading…
Reference in New Issue