[incubator-superset] branch master updated: Upload excel (#9825)
This is an automated email from the ASF dual-hosted git repository. villebro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/master by this push: new fdd28c1 Upload excel (#9825) fdd28c1 is described below commit fdd28c1a5ed6727b12bc30632dcf901db87f0d0a Author: Hossein Torabi AuthorDate: Fri Jul 3 09:58:30 2020 +0430 Upload excel (#9825) --- UPDATING.md| 2 + requirements.txt | 2 +- setup.py | 1 + superset/app.py| 45 -- superset/config.py | 5 +- superset/db_engine_specs/base.py | 36 + .../form_view/excel_to_database_view/edit.html | 64 superset/views/database/forms.py | 174 - superset/views/database/views.py | 162 +-- 9 files changed, 465 insertions(+), 26 deletions(-) diff --git a/UPDATING.md b/UPDATING.md index 0c04796..8eccc80 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -252,6 +252,8 @@ If you run a production system you should schedule downtime for this upgrade. The PRs bellow have more information around the breaking changes: +* [9825](https://github.com/apache/incubator-superset/pull/9825): Support for Excel sheet upload added. To enable support, install Superset with the optional dependency `excel` + * [4587](https://github.com/apache/incubator-superset/pull/4587) : a backward incompatible database migration that requires downtime. Once the db migration succeeds, the web server needs to be restarted with the diff --git a/requirements.txt b/requirements.txt index 1ed3e7b..73e7be6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -100,4 +100,4 @@ yarl==1.4.2 # via aiohttp zipp==3.1.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -# setuptools +# setuptools \ No newline at end of file diff --git a/setup.py b/setup.py index f2a4e1b..897c305 100644 --- a/setup.py +++ b/setup.py @@ -123,6 +123,7 @@ setup( "dremio": ["sqlalchemy_dremio>=1.1.0"], "cockroachdb": ["cockroachdb==0.3.3"], "thumbnails": ["Pillow>=7.0.0, <8.0.0"], +"excel": ["xlrd>=1.2.0, <1.3"], }, python_requires="~=3.6", author="Apache Software Foundation", diff --git a/superset/app.py b/superset/app.py index 7dc7aec..c047a28 100644 --- a/superset/app.py +++ b/superset/app.py @@ -159,7 +159,11 @@ class SupersetAppInitializer: DashboardModelViewAsync, ) from superset.views.database.api import DatabaseRestApi -from superset.views.database.views import DatabaseView, CsvToDatabaseView +from superset.views.database.views import ( +DatabaseView, +CsvToDatabaseView, +ExcelToDatabaseView, +) from superset.views.datasource import Datasource from superset.views.log.api import LogRestApi from superset.views.log.views import LogModelView @@ -265,6 +269,7 @@ class SupersetAppInitializer: appbuilder.add_view_no_menu(Api) appbuilder.add_view_no_menu(CssTemplateAsyncModelView) appbuilder.add_view_no_menu(CsvToDatabaseView) +appbuilder.add_view_no_menu(ExcelToDatabaseView) appbuilder.add_view_no_menu(Dashboard) appbuilder.add_view_no_menu(DashboardModelViewAsync) appbuilder.add_view_no_menu(Datasource) @@ -324,15 +329,35 @@ class SupersetAppInitializer: category="SQL Lab", category_label=__("SQL Lab"), ) -appbuilder.add_link( -"Upload a CSV", -label=__("Upload a CSV"), -href="/csvtodatabaseview/form", -icon="fa-upload", -category="Sources", -category_label=__("Sources"), -category_icon="fa-wrench", -) +if self.config["CSV_EXTENSIONS"].intersection( +self.config["ALLOWED_EXTENSIONS"] +): +appbuilder.add_link( +"Upload a CSV", +label=__("Upload a CSV"), +href="/csvtodatabaseview/form", +icon="fa-upload", +category="Sources", +category_label=__("Sources"), +category_icon="fa-wrench", +) +try: +import xlrd # pylint: disable=unused-import + +if self.config["EXCEL_EXTENSIONS"].intersection( +self.config["ALLOWED_EXTENSIONS"] +): +appbuilder.add_link( +"Upload Excel", +label=__("Upload Excel"), +href="/exceltodatabaseview/form", +icon="fa-upload", +
[incubator-superset] branch master updated: fix(table-viz): format non-numeric metrics (#10234)
This is an automated email from the ASF dual-hosted git repository. yjc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/master by this push: new a6751bf fix(table-viz): format non-numeric metrics (#10234) a6751bf is described below commit a6751bf49a39a42042564c04e2abe7f38f6aec95 Author: Jesse Yang AuthorDate: Thu Jul 2 14:44:15 2020 -0700 fix(table-viz): format non-numeric metrics (#10234) --- .../explore/visualizations/shared.helper.js| 46 + .../explore/visualizations/table.test.ts | 47 ++ superset-frontend/package-lock.json| 6 +-- superset-frontend/package.json | 2 +- 4 files changed, 90 insertions(+), 11 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/shared.helper.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/shared.helper.js index 77c3ee5..4d4eafd 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/shared.helper.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/shared.helper.js @@ -63,6 +63,52 @@ export const NUM_METRIC = { optionName: 'metric_1de0s4viy5d_ly7y8k6ghvk', }; +export const MAX_DS = { + aggregate: 'MAX', + column: { +column_name: 'ds', +description: null, +expression: null, +filterable: true, +groupby: true, +id: 333, +is_dttm: true, +optionName: '_col_ds', +python_date_format: null, +type: 'TIMESTAMP WITHOUT TIME ZONE', +verbose_name: null, + }, + expressionType: 'SIMPLE', + hasCustomLabel: false, + isNew: false, + label: 'MAX(ds)', + optionName: 'metric_pbib7j9m15a_js80vs9vca', + sqlExpression: null, +}; + +export const MAX_STATE = { + expressionType: 'SIMPLE', + column: { +id: 337, +column_name: 'state', +verbose_name: null, +description: null, +expression: null, +filterable: true, +groupby: true, +is_dttm: false, +type: 'VARCHAR(10)', +python_date_format: null, +optionName: '_col_state', + }, + aggregate: 'MAX', + sqlExpression: null, + isNew: false, + hasCustomLabel: false, + label: 'MAX(state)', + optionName: 'metric_kvval50pvbo_hewj3pzacb', +}; + export const SIMPLE_FILTER = { expressionType: 'SIMPLE', subject: 'name', diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts index b7db68e..061fe2d 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts @@ -16,7 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -import { FORM_DATA_DEFAULTS, NUM_METRIC, SIMPLE_FILTER } from './shared.helper'; +import { + FORM_DATA_DEFAULTS, + NUM_METRIC, + MAX_DS, + MAX_STATE, + SIMPLE_FILTER, +} from './shared.helper'; import readResponseBlob from '../../../utils/readResponseBlob'; // Table @@ -29,13 +35,40 @@ describe('Visualization > Table', () => { cy.route('POST', '/superset/explore_json/**').as('getJson'); }); - it('Test table with adhoc metric', () => { -cy.visitChartByParams({ ...VIZ_DEFAULTS, metrics: NUM_METRIC }); -cy.verifySliceSuccess({ - waitAlias: '@getJson', - querySubstring: NUM_METRIC.label, - chartSelector: 'table', + it('Format non-numeric metrics correctly', () => { +cy.visitChartByParams({ + ...VIZ_DEFAULTS, + include_time: true, + granularity_sqla: 'ds', + time_grain_sqla: 'P0.25Y', + metrics: [NUM_METRIC, MAX_DS, MAX_STATE], +}); +// when format with smart_date, time column use format by granularity +cy.get('.chart-container td:nth-child(1)').contains('2008 Q1'); +// other column with timestamp use raw timestamp +cy.get('.chart-container td:nth-child(3)').contains('2008-01-01T00:00:00'); +cy.get('.chart-container td').contains('other'); + }); + + it('Format with table_timestamp_format', () => { +cy.visitChartByParams({ + ...VIZ_DEFAULTS, + include_time: true, + granularity_sqla: 'ds', + time_grain_sqla: 'P0.25Y', + table_timestamp_format: '%Y-%m-%d %H:%M', + metrics: [NUM_METRIC, MAX_DS, MAX_STATE], }); +// time column and MAX(ds) metric column both use UTC time +cy.get('.chart-container td:nth-child(1)').contains('2008-01-01 00:00'); +cy.get('.chart-container td:nth-child(3)').contains('2008-01-01 00:00'); +cy.get('.chart-container td') + .contains('2008-01-01 08:00') + .should('not.exist'); +// time column should not use time granularity when timestamp format is set +cy.get('.chart-container
[incubator-superset] branch master updated (316de3a -> 0afa151)
This is an automated email from the ASF dual-hosted git repository. tai pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git. from 316de3a Update README.md (#10221) add 0afa151 fix(listview): use disableSortBy to disable sorting in table columns (#10223) No new revisions were added by this update. Summary of changes: superset-frontend/src/views/chartList/ChartList.tsx | 9 - superset-frontend/src/views/dashboardList/DashboardList.tsx | 7 +++ superset-frontend/src/views/datasetList/DatasetList.tsx | 11 +-- superset-frontend/src/welcome/DashboardTable.jsx| 3 --- 4 files changed, 16 insertions(+), 14 deletions(-)