Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Viz migration adjustments - 1 #24341

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions superset/migrations/shared/migrate_viz/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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()
Expand Down Expand Up @@ -95,6 +96,7 @@ def _migrate_temporal_filter(self, rv_data: dict[str, Any]) -> None:

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",
Expand Down
4 changes: 3 additions & 1 deletion superset/migrations/shared/migrate_viz/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/migrations/viz/pivot_table_v1_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"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,
Expand Down