Commit Graph

331 Commits

Author SHA1 Message Date
Ville Brofeldt 5bac723df4 Refactor teradata to new time_grain_functions spec (#6539)
* Refactor teradata to new time_grain_functions spec

* Add test for time_grain_functions
2018-12-16 08:53:29 -08:00
Mahendra M 808622414c [SIP-3] Scheduled email reports for Slices / Dashboards (#5294)
* [scheduled reports] Add support for scheduled reports

* Scheduled email reports for slice and dashboard visualization
  (attachment or inline)
* Scheduled email reports for slice data (CSV attachment on inline table)
* Each schedule has a list of recipients (all of them can receive a single mail,
  or separate mails)
* All outgoing mails can have a mandatory bcc - for audit purposes.
* Each dashboard/slice can have multiple schedules.

In addition, this PR also makes a few minor improvements to the celery
infrastructure.
* Create a common celery app
* Added more celery annotations for the tasks
* Introduced celery beat
* Update docs about concurrency / pools

* [scheduled reports] - Debug mode for scheduled emails

* [scheduled reports] - Ability to send test mails

* [scheduled reports] - Test email functionality - minor improvements

* [scheduled reports] - Rebase with master. Minor fixes

* [scheduled reports] - Add warning messages

* [scheduled reports] - flake8

* [scheduled reports] - fix rebase

* [scheduled reports] - fix rebase

* [scheduled reports] - fix flake8

* [scheduled reports] Rebase in prep for merge

* Fixed alembic tree after rebase
* Updated requirements to latest version of packages (and tested)
* Removed py2 stuff

* [scheduled reports] - fix flake8

* [scheduled reports] - address review comments

* [scheduled reports] - rebase with master
2018-12-10 22:29:29 -08:00
Maxime Beauchemin cc3a625a4b
Use py3's f-strings instead of s.format(**locals()) (#6448)
* Use py3's f-strings instead of s.format(**locals())

In light of the bug reported here
https://github.com/apache/incubator-superset/issues/6347, which seems
like an odd `.format()` issue in py3, I greped and replaced all
instances of `.format(**locals())` using py3's f-strings

* lint

* fix tests
2018-12-02 13:50:49 -08:00
Junda Yang f1cae2ecdd override get_view_names in PrestoEngineSpec (#6459)
* override get_view_names in PrestoEngineSpec

* add test

* flake 8

* flake 8
2018-11-28 15:13:38 -08:00
Jiaji Zhou 1eb0d0d835 Remove coordinator in Druid Cluster config (#5164) (#6443) 2018-11-27 09:41:16 -08:00
timifasubaa 91b758f3bc
Reduce data loaded before loading tests (#6298)
* reduce data loaded before loading tests

* make cypress only load needed tests
2018-11-19 15:27:25 -08:00
michellethomas d1a3ba85dd
Adding cypress tests for showing errors, time range filter, and verbose name (#6407)
* Adding cypress tests for showing erros, time range filter, and verbose name

* Adding tests for time range without ago

* Adding test to verify error message showing
2018-11-19 11:29:46 -08:00
John Bodley 0873abde12
[404] Aborting for views with invalid dashboard/slice IDs (#6355) 2018-11-12 10:08:20 -08:00
Christine Chambers 8c0551ed46 [SIP-5] Open a new /api/v1/query endpoint that takes query_obj (#6220)
* [SIP-5] Open a new /api/v1/query endpoint that takes query_obj

- Introduce a new handle_superset_exception decorator to avoid repeating the logic for catching SupersetExceptions
- Create a query_obj_backfill method that takes form_data and constructs a query_obj that will be constructed in the client in the future. Use the backfill in explore_json.
- Create a new /api/v1/query endpoint that takes query_obj only and returns the payload data. Note the query_obj is constructed in the client. The endpoint currently only handles query_obj for table view viz (we'll be adding support to new viz types as we go).
- Unit test to verify the new endpoint for table view

* fix tests and lint errors

* - Move the new query endpoint into its own api.py view.
- Create QueryObject and QueryContext class to encapsulate query_object to be built from the client and additional info (e.g. datasource) needed to get the data payload for a given query
- Remove the query_obj_backfill as we'll start building the first query_object on the client so it no longer makes sense to have a short-lived backfill for the matter of days.

* Fixing lint and test errors

* Fixing additional lint error from the previous rebase.

* fixing additional lint error

* addressing additional pr comments

* Make /query accept a list of queries in the query_context object.

* fixing a lint error

* - Move time_shift based calculation and since, until check into util
- Add typing info for get_since_until
- Add new unit tests to verify time_shift calculation and the since until check
2018-11-07 17:23:52 -08:00
Jeffrey Wang 0584e3629f Add separate limit setting for SqlLab (#4941)
* Add separate limit setting for SqlLab

Use separate param for wrap sql

Get query limit from config

unit tests for limit control rendering in sql editor

py unit test

pg tests

Add max rows limit

Remove concept of infinity, always require defined limits

consistency

Assert on validation errors instead of tooltip

fix unit tests

attempt persist state

pr comments and linting

* load configs in via common param

* default to 1k
2018-11-07 15:57:44 -08:00
Maxime Beauchemin 7b3095d6ff
Fix examples charts/dashboards and refactor (#5881)
* Fix examples charts/dashboards and refactor

* pylinting

* Fix pylint

* Lint the refactor

* Rebased
2018-10-31 15:29:04 -07:00
Junda Yang c552c125d7 Move metadata cache one layer up (#6153)
* Update wording

* nit update for api endpoint url

* move metadata cache one layer up

* refactor cache

* fix flake8 and DatabaseTablesAsync

* nit

* remove logging for cache

* only fetch for all tables that allows cross schema fetch

* default allow_multi_schema_metadata_fetch to False

* address comments

* remove unused defaultdict

* flake 8
2018-10-31 13:23:26 -07:00
Maxime Beauchemin bbfd69a138 [utils.py] gathering/refactoring into a "utils/" folder (#6095)
* [utils] gathering/refactoring into a "utils/" folder

Moving current utils.py into utils/core.py and moving other *util*
modules under this new "utils/" as well.

Following steps include eroding at "utils/core.py" and breaking it down
into smaller modules.

* Improve tests

* Make loading examples in scope for tests

* Remove test class attrs examples_loaded and requires_examples
2018-10-16 17:59:34 -07:00
timifasubaa 46c86672c8 remove utf8 declaration (#6096) 2018-10-15 11:53:24 -07:00
timifasubaa 047c8b0943
remove six dependency (#6091) 2018-10-13 09:38:46 -07:00
timifasubaa 5c5be825d9
remove future imports (#6050) 2018-10-11 09:46:25 -07:00
John Bodley 1ee08fc216
[select-star] Adding optional schema to view (#6051) 2018-10-08 10:32:40 -07:00
Grace Guo a9ef0aeaf5
Revert #5991 (#6035) 2018-10-04 13:43:01 -07:00
yamyamyuo ab5c910801 [bugfix] Fix Tableviz metrics column disorder (#5566)
* fix metrics disorder

* add tableviz metric order tests

* lint code

* use OrderedDict to avoid metrics disorder

* fix unit test
2018-10-04 08:53:26 -07:00
Arpit 73882945bf feat: import/export dashboards via cli (#5991)
* feat: import/export dashboards via cli

* style: fixed lint error

* test: added test for import and export util

* test: removing import test as it is causing integrity issues

Import is a wrapper around exist functionality so we can go ahead without a test or mock the actual db operation using https://docs.python.org/3/library/unittest.mock.html

And validate the wrapper operations only.

* test: remove test data file

* test: removed usage of reserved keyword id
2018-10-01 14:02:16 -07:00
Junda Yang b6d7d57c40 Add schema level access control on csv upload (#5787)
* Add schema level access control on csv upload

* add db migrate merge point

* fix flake 8

* fix test

* remove unnecessary db migration

* fix flake

* nit

* fix test for test_schemas_access_for_csv_upload_endpoint

* fix test_csv_import test

* use security_manager to check whether schema is allowed to be accessed

* bring security manager to the party

* flake8 & repush to retrigger test

* address comments

* remove trailing comma
2018-09-20 11:21:11 -07:00
Maxime Beauchemin b9e3159f7c
Fix regression around low row limit for CSV exports (#5866)
* Fix regression around low row limit for CSV exports

* fix tests

* Still trying to fix tests
2018-09-19 13:30:25 -07:00
Christine Chambers 74940e6a16 Fixing linting error in macro_tests (#5918) 2018-09-17 20:29:14 -07:00
Manuel Silva 041fe52028 Adds a new macro to allow getting filter values easily (#5547)
* Adds new macro to get filter values from "filters" and "extra_filters"

Adds test for filter_values macro

Adds doco for filter_values

Changes filter_values return type to be a list rather than string

* Makes return value type consistent
- filter_values always return a list
2018-09-17 09:36:47 -07:00
michellethomas 657993d609 Moving get_main_db out of tests and into superset utils (#5864) 2018-09-11 22:50:14 -07:00
michellethomas d40ded0be8 Adding simple Cypress tests (#5693)
* Adding simple Cypress tests

* Changing visitChart into multiple commands

* Adding Cypress to tox
2018-09-06 14:55:48 -07:00
timifasubaa d5d592788c fix sqlparse bug and refactor (#5768) 2018-08-29 08:30:49 -07:00
Maxime Beauchemin 135539c109
[bugfix] 'DruidCluster' object has no attribute 'db_engine_spec' (#5765)
* [bugfix] 'DruidCluster' object has no attribute 'db_engine_spec'

* Fix tests
2018-08-28 21:04:06 -07:00
Christine Chambers ae3fb04036 Bug: fixing async syntax for python 3.7 (#5759)
* Bug: fixing async syntax for python 3.7

Rename async to async_ so superset installs for python 3.7.

* Addressing PR comments. Use kwargs instead of explicitly specifying async_ so downstream engines (e.g. PyHive) that supports async can choose to use the async_ in pythonwq3.7 and async in <=python3.6

* addressing additional pr comments
2018-08-28 17:40:45 -07:00
Maxime Beauchemin 09d46a7864 Fix tests 2018-08-26 17:14:15 -07:00
timifasubaa 5c49514e2f
[sqlparse] fix sqlparse bug (#5703)
* fix sqlparse bug

* add one more test case
2018-08-23 11:20:25 -07:00
Maxime Beauchemin 6e8c7f7b20
[viz flow] detect TIMESTAMP, transition to line chart (#5634)
* [viz flow] detect TIMESTAMP, transition to line chart

* Refactor is_date
2018-08-21 21:33:34 -07:00
Sumedh Sakdeo 80e777823b Field names in big query can contain only alphanumeric and underscore (#5641)
* Field names in big query can contain only alphanumeric and underscore

* bad quote

* better place for mutating labels

* lint

* bug fix thanks to mistercrunch

* lint

* lint again
2018-08-21 13:45:42 -07:00
Beto Dealmeida 4c5142d969 Filter out null locations by default (#5642)
* Filter out null locations by default

* Move exception to better place

* Add unit test

* Return columns in order for test and readibility
2018-08-19 16:04:01 -07:00
michellethomas bf0afef7a9 Fix form data issue switching viz types (#5100)
* Fixing issue with extra params in formData

* Pass in param use_slice_data to decide whether to use slice data

* Fixing core_tests to not use explore_json overrides
2018-08-15 11:25:06 -07:00
Maxime Beauchemin 4c2be71e83
[bugfix] TIMESTAMP not detected as date (#5629)
* [bugfix] TIMESTAMP not detected as date

* minor tweak
2018-08-14 13:01:28 -07:00
John Bodley d1ef81f102
[ad-hoc filters] Fixing legacy conversion (#5589) 2018-08-10 10:22:06 -07:00
Maxime Beauchemin 68ba63fcd9
Implement a React-based table editor (#5186)
* A React table editor

* addressing comments

* Fix SelectAsyncControl error on clear

* fix tests

* more corrections

* Removed <strong>
2018-08-06 15:30:13 -07:00
Maxime Beauchemin 9331cf79b5
[sql lab] allow EXPlAIN queries (#5558)
* [sql lab] allow EXPlAIN queries

closes https://github.com/andialbrecht/sqlparse/issues/421

* typo
2018-08-03 15:33:33 -07:00
Maxime Beauchemin 51bd17d6f6
Improve URLs for Chart and Dashboard ModelViews (#5544)
* Improve URLs for Chart and Dashboard ModelViews

Prior to this, the ModelView for Chart and Dashboard would be
at `/slicemodelview/list/` and `/dashboardmodelview/list/`.

Now we have cleaner URLs at `/chart/list/` and `/dashboard/list/`

* Fix unrelated js lint

* addressing comments
2018-08-03 12:46:48 -07:00
Ville Brofeldt e1f4db8e24 Match viz dataframe column case to form_data fields for Snowflake, Oracle and Redshift (#5487)
* Add function to fix dataframe column case

* Fix broken handle_nulls method

* Add case sensitivity option to dedup

* Refactor function definition and call location

* Remove added blank line

* Move df column rename logit to db_engine_spec

* Remove redundant variable

* Update comments in db_engine_specs

* Tie df adjustment to db_engine_spec class attribute

* Fix dedup error

* Linting

* Check for db_engine_spec attribute prior to adjustment

* Rename case sensitivity flag

* Linting

* Remove function that was moved to db_engine_specs

* Get metrics names from utils

* Remove double import and rename dedup variable
2018-08-03 09:53:56 -07:00
Maxime Beauchemin fe6846b8db
[sql lab] simplify the visualize flow (#5523)
* [sql lab] simplify the visualize flow

The "visualize flow" linking SQL Lab to the "explore view" has never
worked so great for people, here's a list of issues:

* it's not really clear to users that their query is wrapped as a
subquery, and the explore view runs queries on top of it

* lint + fix tests

* Addressing comments
2018-08-02 10:52:38 -07:00
John Bodley 47e3c41f5e
[ad-hoc filters] Fixing issue with legacy filters (#5525) 2018-07-31 13:52:20 -07:00
Ville Brofeldt c1e6c68a3e Add time grain blacklist and addons to config.py (#5380)
* Add interim grains

* Refactor and add blacklist

* Change PT30M to PT0.5H

* Linting

* Linting

* Add time grain addons to config.py and refactor engine spec logic

* Remove redundant import and clean up config.py

* Fix bad rebase

* Implement changes proposed by @betodealmeida

* Revert removal of name from Grain

* Linting
2018-07-30 23:44:30 -07:00
Maxime Beauchemin cd55998d63
Improve hive/pyhive error message regex (#5502) 2018-07-27 08:31:37 -07:00
Maxime Beauchemin 94cb20cf96
Apply SQL_QUERY_MUTATOR to explore & dashboard (#5493)
* Apply SQL_QUERY_MUTATOR kn explore & dashboard

* Add unit test
2018-07-26 15:20:23 -07:00
Maxime Beauchemin 41286b7545
[sql lab] extract Hive error messages (#5495)
* [sql lab] extract Hive error messages

So pyhive returns an exception object with a stringified thrift error
object. This PR uses a regex to extract the errorMessage portion of that
string.

* Unit test
2018-07-26 15:17:55 -07:00
JamshedRahman 54fba0f39c Visualization Unicode bug fix (#5387)
* Visualization Unicode bug fix

* Fix the build (#5403)

The travis build has been failing for 2 reasons recently
* pylint takes > 10 minutes without outputing
* bad merge confict auto resolve in controls.jsx

* Visualization Unicode bug fix
2018-07-26 13:18:35 -07:00
Grace Guo 3f2fc8f413
retire dashboard v1 (js and python) (#5418) 2018-07-24 15:23:30 -07:00
Ville Brofeldt a165aec822 Fix broken dedup and remove redundant db_spec logic (#5467)
* Fix broken dedup and remove redundant db_spec logic

* Add test case
2018-07-23 10:41:38 -07:00