You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ly...@apache.org on 2022/10/04 21:19:32 UTC
[superset] branch lyndsi-fix-refetch-async-queries created (now f7641456db)
This is an automated email from the ASF dual-hosted git repository.
lyndsi pushed a change to branch lyndsi-fix-refetch-async-queries
in repository https://gitbox.apache.org/repos/asf/superset.git
at f7641456db Remove query.prevQuery check and write tests for bug fix
This branch includes the following new commits:
new c37e7d153c Merge branch 'fix-edits-gsheet' of https://github.com/apache/superset
new a78c62f06f Merge branch 'master' of https://github.com/apache/superset
new c72108d58d Merge branch 'master' of https://github.com/apache/superset
new f7641456db Remove query.prevQuery check and write tests for bug fix
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[superset] 02/04: Merge branch 'master' of https://github.com/apache/superset
Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lyndsi pushed a commit to branch lyndsi-fix-refetch-async-queries
in repository https://gitbox.apache.org/repos/asf/superset.git
commit a78c62f06fbd184f718210053c7ea68ebab2c5a3
Merge: c37e7d153c 4d0c2ba6ef
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Mon Oct 3 14:14:36 2022 -0500
Merge branch 'master' of https://github.com/apache/superset
.github/workflows/welcome-new-users.yml | 3 +-
RESOURCES/INTHEWILD.md | 3 +
superset-frontend/.eslintrc.js | 1 +
.../cypress/integration/chart_list/filter.test.ts | 4 +-
.../integration/dashboard/drilltodetail.test.ts | 343 +++---
.../cypress/integration/dashboard/editmode.test.ts | 22 +-
.../cypress/integration/dashboard/utils.ts | 14 +-
.../integration/dashboard_list/list.test.ts | 4 +-
.../explore/visualizations/gauge.test.js | 4 +-
.../cypress-base/cypress/utils/urls.ts | 3 +-
superset-frontend/package-lock.json | 4 +
.../src/components/labelUtils.tsx | 6 +-
.../src/shared-controls/dndControls.tsx | 6 +-
.../src/shared-controls/index.tsx | 16 +-
.../src/shared-controls/mixins.tsx | 2 +-
.../src/color/CategoricalColorScale.ts | 3 +-
.../src/connection/callApi/callApi.ts | 2 +-
.../superset-ui-core/src/models/Registry.ts | 2 +-
.../src/switchboard.test.ts | 4 +-
.../scripts/Country Map GeoJSON Generator.ipynb | 714 +++--------
.../src/countries.ts | 38 +
.../src/countries/argentina.geojson | 30 +
.../src/countries/bolivia.geojson | 15 +
.../src/countries/chile.geojson | 22 +
.../src/countries/colombia.geojson | 40 +
.../src/countries/costa rica.geojson | 13 +
.../src/countries/cuba.geojson | 22 +
.../src/countries/dominican republic.geojson | 38 +
.../src/countries/ecuador.geojson | 30 +
.../src/countries/el salvador.geojson | 20 +
.../src/countries/guatemala.geojson | 28 +
.../src/countries/haiti.geojson | 16 +
.../src/countries/honduras.geojson | 24 +
.../src/countries/nicaragua.geojson | 23 +
.../src/countries/panama.geojson | 18 +
.../src/countries/paraguay.geojson | 24 +
.../src/countries/puerto rico.geojson | 7 +
.../src/countries/saint barthelemy.geojson | 7 +
.../src/countries/saint martin.geojson | 7 +
.../src/countries/venezuela.geojson | 32 +
.../src/BigNumber/BigNumberTotal/transformProps.ts | 2 +-
.../BigNumberWithTrendline/transformProps.ts | 2 +-
.../src/BoxPlot/controlPanel.ts | 10 +-
.../plugin-chart-echarts/src/Gauge/buildQuery.ts | 1 -
.../test/Gauge/buildQuery.test.ts | 6 +-
.../src/plugin/buildQuery.ts | 3 -
.../test/plugin/buildQuery.test.ts | 2 +-
superset-frontend/spec/helpers/testing-library.tsx | 2 +-
.../AceEditorWrapper/AceEditorWrapper.test.tsx | 2 +-
.../SqlLab/components/AceEditorWrapper/index.tsx | 20 +-
.../QueryLimitSelect/QueryLimitSelect.test.tsx | 24 +-
.../SqlLab/components/QueryLimitSelect/index.tsx | 19 +-
.../RunQueryActionButton.test.tsx | 177 +--
.../components/RunQueryActionButton/index.tsx | 40 +-
.../{SaveQuery.test.jsx => SaveQuery.test.tsx} | 55 +-
.../src/SqlLab/components/SaveQuery/index.tsx | 79 +-
...LabQuery.test.jsx => ShareSqlLabQuery.test.tsx} | 59 +-
.../SqlLab/components/ShareSqlLabQuery/index.tsx | 21 +-
.../src/SqlLab/components/SqlEditor/index.jsx | 23 +-
.../SqlLab/components/SqlEditorLeftBar/index.tsx | 14 +-
.../hooks/useQueryEditor/index.ts} | 30 +-
.../hooks/useQueryEditor/useQueryEditor.test.ts | 92 ++
superset-frontend/src/SqlLab/reducers/sqlLab.js | 2 +-
.../src/components/Chart/chartReducer.ts | 5 +-
.../src/components/ConfirmStatusChange/index.tsx | 2 +-
.../src/components/Datasource/CollectionTable.tsx | 4 +-
.../ErrorMessage/DatabaseErrorMessage.tsx | 19 +-
.../src/components/FacePile/index.tsx | 4 +-
.../src/components/ListView/Filters/index.tsx | 3 +-
.../HeaderReportDropdown/index.test.tsx | 61 +
.../ReportModal/HeaderReportDropdown/index.tsx | 2 +-
superset-frontend/src/components/Select/utils.tsx | 2 +-
.../src/components/TableCollection/index.tsx | 6 +-
superset-frontend/src/dashboard/actions/hydrate.js | 2 +-
.../DashboardBuilder/DashboardBuilder.tsx | 2 +-
.../components/SliceHeaderControls/index.tsx | 11 +-
.../src/dashboard/components/dnd/DragDroppable.jsx | 2 +
.../src/dashboard/components/dnd/handleHover.js | 2 +
.../components/gridComponents/Markdown.jsx | 8 +-
.../dashboard/components/gridComponents/Tab.jsx | 10 +
.../dashboard/components/gridComponents/Tabs.jsx | 1 +
.../components/gridComponents/new/NewMarkdown.jsx | 4 +-
.../FilterBar/FilterControls/FilterControl.tsx | 2 +-
.../nativeFilters/FilterCard/useFilterScope.ts | 7 +-
.../FiltersConfigModal/FiltersConfigModal.tsx | 2 +-
.../src/dashboard/containers/DashboardPage.tsx | 6 +-
.../src/dashboard/util/filterboxMigrationHelper.ts | 5 +-
.../src/explore/actions/saveModalActions.js | 6 +
.../DndColumnSelectControl/DndFilterSelect.tsx | 5 +-
.../index.tsx | 2 +-
.../src/explore/controlUtils/getControlState.ts | 2 +-
.../exploreUtils/getParsedExploreURLParams.ts | 2 +-
.../components/Select/SelectFilterPlugin.tsx | 2 +-
superset-frontend/src/middleware/asyncEvent.ts | 2 +-
superset-frontend/src/preamble.ts | 2 +-
superset-frontend/src/setup/setupApp.ts | 2 +-
superset-frontend/src/setup/setupClient.ts | 2 +-
.../src/views/CRUD/alert/AlertList.tsx | 2 +-
.../src/views/CRUD/alert/AlertReportModal.tsx | 29 +-
.../src/views/CRUD/annotation/AnnotationModal.tsx | 13 +-
.../CRUD/annotationlayers/AnnotationLayerModal.tsx | 4 +-
.../views/CRUD/csstemplates/CssTemplateModal.tsx | 12 +-
.../src/views/CRUD/dashboard/DashboardCard.tsx | 4 +-
superset-frontend/src/views/CRUD/utils.tsx | 6 +-
.../src/views/components/RightMenu.tsx | 2 +-
superset/cli/examples.py | 4 +-
superset/cli/update.py | 7 +-
superset/common/tags.py | 76 +-
superset/db_engine_specs/base.py | 6 +-
superset/db_engine_specs/bigquery.py | 16 +-
superset/db_engine_specs/gsheets.py | 16 +-
superset/examples/data_loading.py | 2 +-
superset/examples/echarts_dashboard.py | 250 ----
superset/examples/supported_charts_dashboard.py | 1302 ++++++++++++++++++++
superset/models/core.py | 12 +-
superset/models/helpers.py | 41 +-
tests/unit_tests/db_engine_specs/test_bigquery.py | 54 +-
tests/unit_tests/db_engine_specs/test_gsheets.py | 45 +-
118 files changed, 2975 insertions(+), 1426 deletions(-)
[superset] 03/04: Merge branch 'master' of https://github.com/apache/superset
Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lyndsi pushed a commit to branch lyndsi-fix-refetch-async-queries
in repository https://gitbox.apache.org/repos/asf/superset.git
commit c72108d58dff248a0deb0fef25407efdc5006cbc
Merge: a78c62f06f c248ee56e4
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Oct 4 16:13:39 2022 -0500
Merge branch 'master' of https://github.com/apache/superset
RESOURCES/FEATURE_FLAGS.md | 21 +++++++
RESOURCES/INTHEWILD.md | 1 +
requirements/base.txt | 24 +-------
setup.py | 6 +-
.../src/addSlice/AddSliceContainer.tsx | 13 ++--
.../components/Range/RangeFilterPlugin.test.tsx | 26 +++++---
.../filters/components/Range/RangeFilterPlugin.tsx | 4 +-
.../src/profile/components/CreatedContent.tsx | 41 ++++++++----
superset-frontend/src/types/bootstrapTypes.ts | 10 +++
.../views/CRUD/data/dataset/AddDatasetModal.tsx | 14 +++--
superset/charts/api.py | 4 +-
superset/charts/filters.py | 16 +++++
superset/dashboards/filters.py | 2 +-
superset/databases/api.py | 4 ++
superset/databases/commands/validate.py | 7 +--
superset/db_engine_specs/base.py | 7 ++-
superset/db_engine_specs/bigquery.py | 5 +-
superset/db_engine_specs/gsheets.py | 7 ++-
superset/db_engine_specs/snowflake.py | 4 +-
...-09-19_14-42_b92d69a6643c_rename_csv_to_file.py | 2 +-
superset/models/core.py | 17 ++---
superset/reports/commands/exceptions.py | 18 +++++-
superset/reports/commands/execute.py | 24 ++++----
superset/reports/notifications/slack.py | 4 +-
superset/tasks/slack_util.py | 6 +-
superset/views/core.py | 5 ++
tests/integration_tests/charts/api_tests.py | 40 ++++++++++++
tests/integration_tests/dashboards/api_tests.py | 38 ++++++++----
.../db_engine_specs/base_engine_spec_tests.py | 72 ++++++++++++----------
tests/integration_tests/model_tests.py | 4 +-
tests/integration_tests/reports/commands_tests.py | 5 +-
tests/unit_tests/databases/api_test.py | 6 ++
tests/unit_tests/databases/schema_tests.py | 1 -
tests/unit_tests/db_engine_specs/test_gsheets.py | 52 +++++++++-------
34 files changed, 341 insertions(+), 169 deletions(-)
diff --cc superset/databases/commands/validate.py
index dc72fd57c3,a8956257fa..853e813cc6
--- a/superset/databases/commands/validate.py
+++ b/superset/databases/commands/validate.py
@@@ -39,18 -37,9 +39,18 @@@ from superset.models.core import Databa
BYPASS_VALIDATION_ENGINES = {"bigquery"}
+def get_engine_parameters(properties: Dict[str, Any]) -> Dict[str, Any]:
+ try:
+ if properties.get("extra"):
+ return json.loads(properties["extra"]).get("engine_params", {})
+ return {}
+ except:
+ raise DatabaseExtraJSONValidationError("Unable to parse extra_json data")
+
+
class ValidateDatabaseParametersCommand(BaseCommand):
- def __init__(self, parameters: Dict[str, Any]):
- self._properties = parameters.copy()
+ def __init__(self, properties: Dict[str, Any]):
+ self._properties = properties.copy()
self._model: Optional[Database] = None
def run(self) -> None:
[superset] 04/04: Remove query.prevQuery check and write tests for bug fix
Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lyndsi pushed a commit to branch lyndsi-fix-refetch-async-queries
in repository https://gitbox.apache.org/repos/asf/superset.git
commit f7641456db738c93d95cc940b388e0ebfe8792df
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Oct 4 16:19:15 2022 -0500
Remove query.prevQuery check and write tests for bug fix
---
.../SqlLab/components/ResultSet/ResultSet.test.tsx | 83 ++++++++++++++++++----
.../src/SqlLab/components/ResultSet/index.tsx | 6 +-
2 files changed, 70 insertions(+), 19 deletions(-)
diff --git a/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx b/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx
index 2818ed279c..7869a87ab1 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx
@@ -75,6 +75,26 @@ const newProps = {
},
},
};
+const asyncQueryProps = {
+ ...mockedProps,
+ database: { allow_run_async: true },
+};
+const asyncRefetchDataPreviewProps = {
+ ...asyncQueryProps,
+ query: {
+ state: 'success',
+ results: undefined,
+ isDataPreview: true,
+ },
+};
+const asyncRefetchResultsTableProps = {
+ ...asyncQueryProps,
+ query: {
+ state: 'success',
+ results: undefined,
+ resultsKey: 'async results key',
+ },
+};
fetchMock.get('glob:*/api/v1/dataset?*', { result: [] });
const middlewares = [thunk];
@@ -86,13 +106,13 @@ const setup = (props?: any, store?: Store) =>
});
describe('ResultSet', () => {
- it('renders a Table', async () => {
+ test('renders a Table', async () => {
const { getByTestId } = setup(mockedProps, mockStore(initialState));
const table = getByTestId('table-container');
expect(table).toBeInTheDocument();
});
- it('should render success query', async () => {
+ test('should render success query', async () => {
const { queryAllByText, getByTestId } = setup(
mockedProps,
mockStore(initialState),
@@ -114,7 +134,7 @@ describe('ResultSet', () => {
expect(exploreButton).toBeInTheDocument();
});
- it('should render empty results', async () => {
+ test('should render empty results', async () => {
const props = {
...mockedProps,
query: { ...mockedProps.query, results: { data: [] } },
@@ -128,7 +148,7 @@ describe('ResultSet', () => {
expect(alert).toHaveTextContent('The query returned no data');
});
- it('should call reRunQuery if timed out', async () => {
+ test('should call reRunQuery if timed out', async () => {
const store = mockStore(initialState);
const propsWithError = {
...mockedProps,
@@ -143,26 +163,26 @@ describe('ResultSet', () => {
expect(store.getActions()[0].type).toEqual('START_QUERY');
});
- it('should not call reRunQuery if no error', async () => {
+ test('should not call reRunQuery if no error', async () => {
const store = mockStore(initialState);
setup(mockedProps, store);
expect(store.getActions()).toEqual([]);
});
- it('should render cached query', async () => {
+ test('should render cached query', async () => {
const store = mockStore(initialState);
const { rerender } = setup(cachedQueryProps, store);
// @ts-ignore
rerender(<ResultSet {...newProps} />);
- expect(store.getActions()).toHaveLength(1);
+ expect(store.getActions()).toHaveLength(2);
expect(store.getActions()[0].query.results).toEqual(
cachedQueryProps.query.results,
);
expect(store.getActions()[0].type).toEqual('CLEAR_QUERY_RESULTS');
});
- it('should render stopped query', async () => {
+ test('should render stopped query', async () => {
await waitFor(() => {
setup(stoppedQueryProps, mockStore(initialState));
});
@@ -171,13 +191,13 @@ describe('ResultSet', () => {
expect(alert).toBeInTheDocument();
});
- it('should render running/pending/fetching query', async () => {
+ test('should render running/pending/fetching query', async () => {
const { getByTestId } = setup(runningQueryProps, mockStore(initialState));
const progressBar = getByTestId('progress-bar');
expect(progressBar).toBeInTheDocument();
});
- it('should render fetching w/ 100 progress query', async () => {
+ test('should render fetching w/ 100 progress query', async () => {
const { getByRole, getByText } = setup(
fetchingQueryProps,
mockStore(initialState),
@@ -187,7 +207,7 @@ describe('ResultSet', () => {
expect(getByText('fetching')).toBeInTheDocument();
});
- it('should render a failed query with an error message', async () => {
+ test('should render a failed query with an error message', async () => {
await waitFor(() => {
setup(failedQueryWithErrorMessageProps, mockStore(initialState));
});
@@ -196,21 +216,56 @@ describe('ResultSet', () => {
expect(screen.getByText('Something went wrong')).toBeInTheDocument();
});
- it('should render a failed query with an errors object', async () => {
+ test('should render a failed query with an errors object', async () => {
await waitFor(() => {
setup(failedQueryWithErrorsProps, mockStore(initialState));
});
expect(screen.getByText('Database error')).toBeInTheDocument();
});
- it('renders if there is no limit in query.results but has queryLimit', async () => {
+ test('renders if there is no limit in query.results but has queryLimit', async () => {
const { getByRole } = setup(mockedProps, mockStore(initialState));
expect(getByRole('grid')).toBeInTheDocument();
});
- it('renders if there is a limit in query.results but not queryLimit', async () => {
+ test('renders if there is a limit in query.results but not queryLimit', async () => {
const props = { ...mockedProps, query: queryWithNoQueryLimit };
const { getByRole } = setup(props, mockStore(initialState));
expect(getByRole('grid')).toBeInTheDocument();
});
+
+ test('Async queries - renders "Fetch data preview" button when data preview has no results', () => {
+ setup(asyncRefetchDataPreviewProps, mockStore(initialState));
+ expect(
+ screen.getByRole('button', {
+ name: /fetch data preview/i,
+ }),
+ ).toBeVisible();
+ expect(screen.queryByRole('grid')).toBe(null);
+ });
+
+ test('Async queries - renders "Refetch results" button when a query has no results', () => {
+ setup(asyncRefetchResultsTableProps, mockStore(initialState));
+ expect(
+ screen.getByRole('button', {
+ name: /refetch results/i,
+ }),
+ ).toBeVisible();
+ expect(screen.queryByRole('grid')).toBe(null);
+ });
+
+ test('Async queries - renders on the first call', () => {
+ setup(asyncQueryProps, mockStore(initialState));
+ expect(screen.getByRole('grid')).toBeVisible();
+ expect(
+ screen.queryByRole('button', {
+ name: /fetch data preview/i,
+ }),
+ ).toBe(null);
+ expect(
+ screen.queryByRole('button', {
+ name: /refetch results/i,
+ }),
+ ).toBe(null);
+ });
});
diff --git a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
index 78387f6dc4..0d61d8ddab 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
@@ -164,11 +164,7 @@ const ResultSet = ({
setCachedData(query.results.data);
dispatch(clearQueryResults(query));
}
- if (
- query.resultsKey &&
- prevQuery?.resultsKey &&
- query.resultsKey !== prevQuery.resultsKey
- ) {
+ if (query.resultsKey && query.resultsKey !== prevQuery?.resultsKey) {
fetchResults(query);
}
}, [query, cache]);
[superset] 01/04: Merge branch 'fix-edits-gsheet' of https://github.com/apache/superset
Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lyndsi pushed a commit to branch lyndsi-fix-refetch-async-queries
in repository https://gitbox.apache.org/repos/asf/superset.git
commit c37e7d153c23f6fdfb2f033295e82e76cb1f4d16
Merge: 0dda5fe1cf 33e9630511
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Sep 29 14:23:28 2022 -0500
Merge branch 'fix-edits-gsheet' of https://github.com/apache/superset
superset/databases/commands/validate.py | 18 ++++++++++++++----
superset/db_engine_specs/gsheets.py | 1 -
2 files changed, 14 insertions(+), 5 deletions(-)