mirror of https://github.com/apache/superset.git
Fixing the examples (#7376)
Fixing a few failing examples, examples were referencing metrics that were getting auto-generated in the past (like `sum__num`), that we now prevent from getting created.
This commit is contained in:
parent
39f83b5490
commit
ab8af536b0
|
@ -26,10 +26,10 @@ export default {
|
|||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
['line_column', 'line_type'],
|
||||
['adhoc_filters'],
|
||||
['metric', 'point_radius_fixed'],
|
||||
['row_limit', null],
|
||||
['line_column', 'line_type'],
|
||||
['reverse_long_lat', 'filter_nulls'],
|
||||
],
|
||||
},
|
||||
|
|
|
@ -171,6 +171,7 @@ const metric = {
|
|||
...metrics,
|
||||
multi: false,
|
||||
label: t('Metric'),
|
||||
description: t('Metric'),
|
||||
default: props => mainMetric(props.savedMetrics),
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,15 @@ def load_birth_names():
|
|||
"granularity_sqla": "ds",
|
||||
"groupby": [],
|
||||
"metric": "sum__num",
|
||||
"metrics": ["sum__num"],
|
||||
"metrics": [
|
||||
{
|
||||
"expressionType": "SIMPLE",
|
||||
"column": {"column_name": "num", "type": "BIGINT"},
|
||||
"aggregate": "SUM",
|
||||
"label": "Births",
|
||||
"optionName": "metric_11",
|
||||
}
|
||||
],
|
||||
"row_limit": config.get("ROW_LIMIT"),
|
||||
"since": "100 years ago",
|
||||
"until": "now",
|
||||
|
@ -261,11 +269,7 @@ def load_birth_names():
|
|||
datasource_type="table",
|
||||
datasource_id=tbl.id,
|
||||
params=get_slice_json(
|
||||
defaults,
|
||||
viz_type="pivot_table",
|
||||
metrics=["sum__num"],
|
||||
groupby=["name"],
|
||||
columns=["state"],
|
||||
defaults, viz_type="pivot_table", groupby=["name"], columns=["state"]
|
||||
),
|
||||
),
|
||||
Slice(
|
||||
|
|
|
@ -76,11 +76,10 @@ def load_unicode_test_data():
|
|||
"granularity_sqla": "dttm",
|
||||
"groupby": [],
|
||||
"metric": {
|
||||
"expressionType": "SIMPLE",
|
||||
"column": {"column_name": "value", "type": "INT"},
|
||||
"aggregate": "SUM",
|
||||
"label": "value",
|
||||
"optionName": "metric_11",
|
||||
"column": {"column_name": "value"},
|
||||
"expressionType": "SIMPLE",
|
||||
"label": "Value",
|
||||
},
|
||||
"row_limit": config.get("ROW_LIMIT"),
|
||||
"since": "100 years ago",
|
||||
|
|
|
@ -106,7 +106,17 @@ def load_world_bank_health_n_pop():
|
|||
"where": "",
|
||||
"markup_type": "markdown",
|
||||
"country_fieldtype": "cca3",
|
||||
"secondary_metric": "sum__SP_POP_TOTL",
|
||||
"secondary_metric": {
|
||||
"aggregate": "SUM",
|
||||
"column": {
|
||||
"column_name": "SP_RUR_TOTL",
|
||||
"optionName": "_col_SP_RUR_TOTL",
|
||||
"type": "DOUBLE",
|
||||
},
|
||||
"expressionType": "SIMPLE",
|
||||
"hasCustomLabel": True,
|
||||
"label": "Rural Population",
|
||||
},
|
||||
"entity": "country_code",
|
||||
"show_bubbles": True,
|
||||
}
|
||||
|
@ -244,7 +254,6 @@ def load_world_bank_health_n_pop():
|
|||
defaults,
|
||||
viz_type="sunburst",
|
||||
groupby=["region", "country_name"],
|
||||
secondary_metric="sum__SP_RUR_TOTL",
|
||||
since="2011-01-01",
|
||||
until="2011-01-01",
|
||||
),
|
||||
|
|
|
@ -683,7 +683,7 @@ class PivotTableViz(BaseViz):
|
|||
if self.form_data.get("granularity") == "all" and DTTM_ALIAS in df:
|
||||
del df[DTTM_ALIAS]
|
||||
|
||||
aggfunc = self.form_data.get("pandas_aggfunc")
|
||||
aggfunc = self.form_data.get("pandas_aggfunc") or "sum"
|
||||
|
||||
# Ensure that Pandas's sum function mimics that of SQL.
|
||||
if aggfunc == "sum":
|
||||
|
|
|
@ -280,7 +280,8 @@ class CoreTests(SupersetTestCase):
|
|||
]
|
||||
for name, method, url in urls:
|
||||
logging.info(f"[{name}]/[{method}]: {url}")
|
||||
self.client.get(url)
|
||||
resp = self.client.get(url)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
def test_tablemodelview_list(self):
|
||||
self.login(username="admin")
|
||||
|
|
Loading…
Reference in New Issue