Commit Graph

630 Commits

Author SHA1 Message Date
Ville Brofeldt 1982b74af2 Add check for calls to cache_key_wrapper (#8128)
* Add check for calls to cache_key_wrapper to avoid unavoidable compilation of query

* Add fetch_values_predicate to check

* Only check relevant attributes

* Address nit
2019-08-27 13:36:05 -07:00
Dave Smith 6dc760a054 Add LogConfigurator, and add logging for CSV export (#8085)
* Add LogConfigurator, and add logging for CSV export

* tweak for PR feedback

* fix linter issue
2019-08-27 13:22:18 -07:00
Ville Brofeldt fb51632e18
Add docstrings and typing to db_engine_specs and sql_parse (#8058)
* Add typing to db_engine_specs

* Add more type annotations and docstrings

* Add docstrings and typing to sql_parse and db_engine_specs

* Refine select_star

* Fix execute and add more docstrings

* Revert kwargs change from execute

* Remove redundant or

* Align view and table getter schema types

* Fix return type of latest_partition

* Remove some typing from presto

* Improve docstring for __extract_from_token
2019-08-22 06:29:32 +03:00
Beto Dealmeida aae9b56232 Move more Presto nested types behind feature flag (#8075)
* Move more stuff behind ff

* Fix unit tests

* Fix more tests

* Fix lint
2019-08-20 16:10:55 -07:00
Maxime Beauchemin 4e7ea3f3e2
Improve birth example dashboard (#8042)
* Improve birth example dashboard

* Fix tests

* pylint
2019-08-18 22:36:27 -07:00
Beto Dealmeida 478d0969a8
Add feature flag for Presto expand data (#8056)
* Add feature flag for Presto expand data

* Fix unit tests

* Fix black

* Revert temporary file change
2019-08-15 20:10:05 -07:00
serenajiang 17f0740692 Fix bug where lists in queries cannot contain multiple types (#8032)
* use set instead of sorted to check equality of lists

* run black
2019-08-13 23:06:44 +03:00
Dave Smith 9233a63a16 Event logger config takes instance instead of class (#7997)
* allow preconfigured event logger instance; deprecate specifying class

* add func docs and simplify conditions

* modify docs to reflect EVENT_LOGGER cfg change

* commit black formatting fixes and license header

* add type checking, fix other pre-commit failues

* remove superfluous/wordy condition

* fix flake8 failure

* fix new black failure

* dedent warning msg; use f-strings
2019-08-08 13:47:18 -07:00
Daniel Vaz Gaspar 73cdad2375 [SQLLab] Fix, database api unlimited page size v2 (#8002)
* [database] Fix, Removes the limit for the page size, Bump FAB to 2.1.8

Old FAB API had no limits by default, this will keep this behaviour
but only for this endpoint

* [sqllab] Add test for database API

* [sqllab] Add test for database API

* [sqllab] Include page zero on request

* [sqllab] Fix, Black and requirements

* [sqllab] Make database API return unlimited results

* [sqllab] just a test

* [sqllab] Bump FAB to 2.1.9

* [sqllab] Remove unused import
2019-08-08 11:37:00 -07:00
John Bodley fdb62e9865
[flake8] Ignoring I202 (#7988) 2019-08-05 15:01:33 -07:00
Erik Ritter d58dbad076 [DB Engine] Support old and new Presto syntax (#7977) 2019-08-05 11:56:56 -07:00
John Bodley f7af50c399
[security] Adding docstrings and type hints (#7952) 2019-08-05 11:24:13 -07:00
Gianluca Ciccarelli e23920b8ba 7620: Start removing dependencies on requests (#7643)
* 7620: Start removing dependencies on requests

* Patch urllib.request.urlopen instead of requests.get

* Try to fix flake8

* More work on flake8 import errors

* First attempt at using urllib with cookies

* Fix pylint/flake8

* Fix test_deliver_slice_csv_attachment

* Fix test_deliver_slice_csv_inline

* Import requests and pydruid conditionally, remove dependency on prison

* Fix flake errors

* Fix load_examples

* Please flake

* Skip tests depending on optional deps

* Try to please flake

* Address review comments

* Remove Druid-related UI

* Revert "Remove Druid-related UI"

This reverts commit d7e0f166cc3f3dd2496b4a666e177f0c191aeb0f.

* Skip a few tests more

* Put imports in right order

* Apply black patch

* Please flake

* Please black, silence flake

* Use flake8 silencing the right way

* Add deps for CI
2019-08-02 10:01:28 -07:00
John Bodley af462fe79f
[revert] Partial revert of #7888 (#7933) 2019-07-29 09:19:21 -07:00
Daniel Vaz Gaspar 994ac04c1f [cli] New, command line option to create or set a db URI (#7918)
* [cli] New, command line option to create or set a db URI

* [tests] New, get or create db on utils

* [tests] flake8 and black

* [tests] Fix, remove dummy comments

* [cli] dummy commit to re-trigger build

* [cli] dummy commit to re-trigger build
2019-07-27 17:43:39 -07:00
Ville Brofeldt 72d1011023
[sqllab] Fix limit parsing bug when using limit-offset comma notation (#7912)
* Fix limit parsing bug when using limit-offset comma notation

* Use native sqlparse semantics to find limit

* black
2019-07-24 08:18:39 +03:00
Ville Brofeldt 07a76f83b1
[Bugfix] Remove prequery properties from query_obj (#7896)
* Create query_obj for every filter

* Deprecate is_prequery and prequeries from query_obj

* Fix tests

* Fix typos and remove redundant ; from sql

* Add typing to namedtuples and move all query str logic to one place

* Fix unit test
2019-07-23 22:13:58 +03:00
Maxim Sukharev 648f9fa54b Set owner to dashboards and charts on import (#7894)
* Allow to pass user for dashboard import cli

Dashboard import assign current user from flask context during import.
But in case of cli import there is no flask user and imported charts
don't have an owner which prevents ability to edit them.

* Reset ownership on dashboard import

For overriding existing charts it requires `owners` property to be set.

* Add tests for reset ownership

* Use ORM to decode dashboards json

Creating instances using ORM allows to normally work with relations

* Fix test_import_dashboard_1_slice test

Previously tests used side-effect of slices import which kept id from
json on insert into db.
2019-07-22 22:30:28 -07:00
Daniel Vaz Gaspar b65ab51b63 [api] [database] New, migrate to new FAB API side by side (#7665)
* [api] [database] New, migrate to new FAB API side by side

* [database] view and api module reorganization

* [style] Fix, flake8

* [test] [database] Fix, tests for new database view structure

* [style] [database] black

* [database] Fix, missing apache license

* Migrate databaasync api to the new api

* flake8

* More efficient api call

* Revert querySearch to old API, test

* dummy commit

* revert config.py commit

* Remove unused import

* Remove old API view

* Remove new API view

* Add database filter

* Add database filter

* Add database filter

* Remove comments on js

* Fix JS test

* Fix pylint

* QuerySearch new databaseasync API endpoint

* Fix, query search new api endpoint

* Reintroduce old API for smooth side by side migration

* Better naming and use common hooks for view and API

* black it

* Fix, database mixin must come first

* Fix, lint
2019-07-22 21:25:16 -07:00
Arpit ee3430cce5 [Bugfix] Response header and response mismatch on explore result from sqllab (#7907)
* fix(sql-lab explore):   fixed response data and header type to be aligned

* fix(sql-lab explore):   fixed test error caused by incorrect test at master

* fix(sql-lab explore):   reformatted

* fix(sql-lab explore):   removed unused import
2019-07-22 08:47:34 +03:00
Ville Brofeldt 4568b2a532 Add cache_key_wrapper to Jinja template processor (#7816) 2019-07-20 09:12:35 -07:00
John Bodley ccedbea506
[fix] Adding space after -- for SQL comments (#7897) 2019-07-18 13:17:26 -07:00
John Bodley 2b3e7fe4de
[sqla] Adding check for invalid filter columns (#7888) 2019-07-18 08:51:41 -07:00
Maxim Sukharev b512502d72 Remove unnecessary fields from dashboard exported json (#7879)
* Remove unnecessary fields from dashboard exported json

This commit makes export respect export_fields and doesn't export
unnecessary relations (like users with passwords hashes) which are
ignored during the import.

* Allow to import dashboard without position_json

In case charts were added from chart-edit page and wasn't re-ordered on
the dashboard position_json field is empty and import was failing with
error.

* Update export/import tests
2019-07-17 22:22:10 -07:00
Maxime Beauchemin d65b039219
Improve examples & related tests (#7773)
* [WiP] improve load_examples

related to #7472, longer term we will generate the examples by exporting
them into tarball as in #7472. In the meantime, we need this subset of
the features:

* allowing specifying an alternate database connection for examples
* allowing a --only-metadata flag to `load_examples` to load only
  dashboard and chart definitions, no actual data is loaded

* Improve logging

* Rename data->examples

* Load only if not exist

* By default do not load, add a force flag

* fix build

* set published to true
2019-07-16 21:36:56 -07:00
Rob DiCiuccio df051813d5 Adds the ability to replace/extend caching backend (#7856)
* Add ability to override cache backend with custom module

* Tests for setup_cache

* Add custom CACHE_CONFIG documentation

* Fix linter errors and documentation link

* Fix black formatting errors
2019-07-12 14:06:56 -07:00
Maxime Beauchemin 87f50ba0d8
Make SHOW_STACKTRACE config apply across the board (#7845) 2019-07-12 08:58:44 -07:00
Tresdon Jones 97ffb762d0 Add "Published" feature to dashboards (#4725)
* Allow users to publish dashboards

* Rework publish dashboards feature

- The eye next to the title has been replaced with a [draft] badge
- Published status is now toggled in the Header Action Dropdown
- CRUD list shows published status

* Fix linter errors

* Update javascript tests

* Add tests and change DashboardFilter

Add some tests to make sure the published status is rendered and
Make it so that users cannot see dashboards that are published
if they don't have access to any of the slices within

* Fix some linter errors

* Remove commas from core.py

* Fix some failing tests

* More linter errors I introduced

* Fix more linter errors I introduced

* update alembic migration

* Update design of publish dash feature

* Upgrade migration version

* Secure publish endpoint

* Remove bad quotes

* Give publish span its own style

* fix publish rendering

* Add new test for publish feature

* Update migration

* update slug in test

* Update migration

* Address reviwer comments

* Fix linter errors

* Add licenses

* Remove fetchPublished(), use bootstrap data

* Update migration

* Update croniter to existing version

* Fix linter errors

* Upgrade DB Revisions

* Fix flake8 linter error

* Set all dashboards to published on migration

* Migration proper line spacing

* Fix migration to work with postgres

* UPDATE statement works with postgresql and sqlite hopefully

* Update wording to kick off travis
2019-07-10 23:14:13 -07:00
Maxime Beauchemin ab8af536b0
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.
2019-07-04 13:23:02 -07:00
John Bodley 9dac805e7e
[schema] Deprecating the table_columns.database_expression column (#7653) 2019-07-03 14:05:59 -07:00
John Bodley 6d7701e684
[fix] Updating Pandas resample logic (#7799) 2019-07-02 11:10:50 -07:00
John Bodley ffa7c617ad
[travis] Adding Black tox environment (#7809) 2019-07-01 18:05:15 -07:00
John Bodley e0d040c377
[fix] Handling of non-existent datasource (#7755) 2019-07-01 11:55:25 -07:00
Kim Truong 5994e432d4 feat: query based on all partitions (#7782)
* feat: query based on all partitions

* fix: address Beto's comments
2019-06-27 11:19:55 -07:00
John Bodley 5c58fd1802
[format] Using Black (#7769) 2019-06-25 13:34:48 -07:00
Maxime Beauchemin 859d6e7c6a
chore: taking db dependencies out of requirements-dev.txt (#7605)
* chore: taking db dependencies out of requirements-dev.txt

The deps on mysqlclient and psycopg2

* Fix unit tests

* fix tox.ini

* fix tests
2019-06-23 22:37:41 -07:00
Ville Brofeldt 1c4092c61c Add csv upload support for BigQuery (#7756)
* Add extra_require for bigquery to setup.py

* Refactor df_to_db and add df upload capability for BigQuery

* Fix unit tests and clarify kwarg logic

* Fix flake8 errors

* Add minimum versions for bigquery dependencies

* wrap to_gbq in try-catch block and raise error if pandas-gbq is missing

* Fix linting error and make error more generic
2019-06-23 14:20:09 -07:00
michellethomas 7a575ce20a
Fixing time comparison to look for past deltas (#7616)
* Fixing time comparison to look for past deltas

* Adding note to updating about time_compare
2019-06-19 10:10:18 -07:00
Ville Brofeldt 95291facff
Break up db_engine_specs (#7676)
* Refactor db_engine_specs into package

* Rename bigquery class and add epoch funcs

* Fix flake8 errors

* Dynamically load all engine specs

* Fix linting errors and unit tests

* Implement Snowflake epoch time funcs

* Implement Teradata epoch time func

* Fix presto datasource query and remove unused import

* Fix broken datasource query

* Add mypy ignore for false positive

* Add missing license files

* Make create_time_grains_tuple public

* Fix flake8 quote

* Fix incorrect licence header
2019-06-08 11:27:13 -07:00
Erik Ritter f7812a3f27 [SQL Lab] Clarify SQL Lab query and display limits (#7641) 2019-06-07 17:16:38 -07:00
John Bodley 45b41aadcc
[fix] SQL parsing of table names (#7490) 2019-06-03 11:07:57 -07:00
Jim Horng 78c1674dc7 make filter_values() macro to properly accept value from filter box with single value setting (#7494) 2019-06-03 09:54:07 -07:00
Maxime Beauchemin 45b9880516
fix: SqlaColumn.type overflow on mysql (#7606)
* fix: SqlaColumn.type overflow on mysql

Hitting a new error when loading examples around a datatype that exceeds
the 32 chars limit on SqlaColumn.type

Type includes the 'COLLATE utf8mb4_general_ci' suffix which is too
verbose and not needed in that context.

* fix tests
2019-06-03 09:52:25 -07:00
Maxime Beauchemin 4b5931f637
Alternative fix for #7559 (#7575)
* Alternative fix for #7559

Just an idea...

* logging
2019-06-01 09:21:35 -07:00
Erik Ritter 722043c672 Allow trailing spaces in simple filter values (#7617) 2019-05-31 17:06:41 -07:00
Kim Truong 9acafd5b75 fix: handle presto columns with whitespace (#7630) 2019-05-31 13:38:05 -07:00
Kim Truong d2967340d9 View Presto row and array objects clearly in the data grid (#7625)
* feat: rough check in for Presto rows and arrays

* fix: presto arrays

* fix: return selected and expanded columns

* fix: add helper methods and unit tests

* fix: only allow exploration of selected columns

* fix: address Beto's comments and add more unit tests
2019-05-31 11:25:07 -07:00
Ville Brofeldt c1712e5d10
Add relative start param for time filters (#7525)
* Add relative start param for time filters

* Fix typo and add types to parse_human_datetime

* Add relative start/end to query_object

* Fix linting error
2019-05-31 16:55:26 +03:00
Ville Brofeldt 34407e8962
Make timestamp expression native SQLAlchemy element (#7131)
* Add native sqla component for time expressions

* Add unit tests and remove old tests

* Remove redundant _grains_dict method

* Clarify time_grain logic

* Add docstrings and typing

* Fix flake8 errors

* Add missing typings

* Rename to TimestampExpression

* Remove redundant tests

* Fix broken reference to db.database_name due to refactor
2019-05-30 08:28:37 +03:00
Maxime Beauchemin fd5befee38
Bump python libs, address insecure releases (#7550)
* Bump python libs, address insecure releases

Using
https://requires.io/github/mistercrunch/superset/requirements/?branch=apache_release_improv
to identify insecure, old releases we're using and bumping.

* redis <3.0

* fix new flakes
2019-05-28 21:03:49 -07:00
Ville Brofeldt f7d3413a50
Add support for period character in table names (#7453)
* Move schema name handling in table names from frontend to backend

* Rename all_schema_names to get_all_schema_names

* Fix js errors

* Fix additional js linting errors

* Refactor datasource getters and fix linting errors

* Update js unit tests

* Add python unit test for get_table_names method

* Add python unit test for get_table_names method

* Fix js linting error
2019-05-26 06:13:16 +03:00
John Bodley 6b9790c8b1
[ad-hoc] Fixing type for count distinct (#7573) 2019-05-22 09:41:25 -07:00
Daniel Vaz Gaspar 74704f68c7 [security] New, deprecate merge_perm, FAB method is fixed (#7355)
* [security] New, deprecate merge_perm, FAB method is fixed

* [style] Fix, flakes

* [tests] Fix, change merge_perm to add_permission_view_menu

* [security] Fix, maintain merge_perm for compatibility

* [security] New, deprecation warning on merge_perm method

* [style] Fix, flake8 C812
2019-05-20 17:30:00 -07:00
Maxime Beauchemin d8be0a7dd5
Break line before LIMIT statement to prevent trailing comment issue (#7485)
* Break line before LIMIT statement to prevent trailing comment issue

This may not be a perfect solution but it addresses the issue in 7483

closes https://github.com/apache/incubator-superset/issues/7483

* fix tests
2019-05-13 00:34:34 -05:00
Ville Brofeldt 959c35d506 bugfix: Improve support for special characters in schema and table names (#7297)
* Bugfix to SQL Lab to support tables and schemas with characters that require quoting

* Remove debugging prints

* Add uri encoding to secondary tables call

* Quote schema names for presto

* Quote selected_schema on Snowflake, MySQL and Hive

* Remove redundant parens

* Add python unit tests

* Add js unit test

* Fix flake8 linting error
2019-05-08 00:37:44 -05:00
Alex Berghage 24970485cf feat: Add `validate_sql_json` endpoint for checking that a given sql query is valid for the chosen database (#7422) (#7462)
merge from lyft-release-sp8 to master
2019-05-06 10:21:02 -07:00
Kim Truong 88e6ec992c feat: view presto row objects in data grid (#7445)
* Merge lastest from master into lyft-release-sp8 (#7405)

* filter out all nan series (#7313)

* improve not rich tooltip (#7345)

* Create issue_label_bot.yaml (#7341)

* fix: do not save colors without a color scheme (#7347)

* [wtforms] Strip leading/trailing whitespace (#7084)

* [schema] Updating the datasources schema (#5451)

* limit tables/views returned if schema is not provided (#7358)

* limit tables/views returned if schema is not provided

* fix typo

* improve code performance

* handle the case when table name or view name does not present a schema

* Add type anno (#7342)

* Updated local dev instructions to include missing step

* First pass at type annotations

* [schema] Updating the base column schema (#5452)

* Update 937d04c16b64_update_datasources.py (#7361)

* Feature flag for client cache (#7348)

* Feature flag for client cache

* Fix integration test

* Revert "Fix integration test"

This reverts commit 58434ab98a.

* Feature flag for client cache

* Fix integration tests

* Add feature flag to config.py

* Add another feature check

* Fix more integration tests

* Fix raw HTML in SliceAdder (#7338)

* remove backendSync.json (#7331)

* [bubbles] issue when using duplicated metrics (#7087)

* SUPERSET-7: Docker compose config version breaks on Ubuntu 16.04 (#7359)

* SUPERSET-8: Update text in docs copyright footer (#7360)

* SUPERSET-7: Docker compose config version breaks on Ubuntu 16.04

* SUPERSET-8: Extra text in docs copyright footer

* [schema] Adding commits and removing unnecessary foreign-key definitions (#7371)

*  Store last selected dashboard in sessionStorage (#7181)

* Store last selected dashboard in sessionStorage

* Fix tests

* [schema] Updating the base metric schema (#5453)

* Fix NoneType bug & fill the test recipients with original recipients if empty (#7365)

* feat: see Presto row and array data types (#7391)

* feat: see Presto row and array data types

* fix: address PR comments

* fix: lint and build issues

* fix: add types

* Incorporate feedback from initial PR (prematurely merged to lyft-release-sp8) (#7415)

* add stronger type hints where possible

* fix: lint issues and add select_star func in Hive

* add missing pkg init

* fix: build issues

* fix: pylint issues

* fix: use logging instead of print

* feat: view presto row objects in data grid

* fix: address feedback

* fix: spacing
2019-05-03 16:29:57 -07:00
John Bodley fb627ba376
[fix] Fixing SQL parsing issue (#7374) 2019-05-01 22:07:01 -07:00
Dave Smith a6aabf8268 feature: see Presto row and array data types (#7413)
* Merge lastest from master into lyft-release-sp8 (#7405)

* filter out all nan series (#7313)

* improve not rich tooltip (#7345)

* Create issue_label_bot.yaml (#7341)

* fix: do not save colors without a color scheme (#7347)

* [wtforms] Strip leading/trailing whitespace (#7084)

* [schema] Updating the datasources schema (#5451)

* limit tables/views returned if schema is not provided (#7358)

* limit tables/views returned if schema is not provided

* fix typo

* improve code performance

* handle the case when table name or view name does not present a schema

* Add type anno (#7342)

* Updated local dev instructions to include missing step

* First pass at type annotations

* [schema] Updating the base column schema (#5452)

* Update 937d04c16b64_update_datasources.py (#7361)

* Feature flag for client cache (#7348)

* Feature flag for client cache

* Fix integration test

* Revert "Fix integration test"

This reverts commit 58434ab98a.

* Feature flag for client cache

* Fix integration tests

* Add feature flag to config.py

* Add another feature check

* Fix more integration tests

* Fix raw HTML in SliceAdder (#7338)

* remove backendSync.json (#7331)

* [bubbles] issue when using duplicated metrics (#7087)

* SUPERSET-7: Docker compose config version breaks on Ubuntu 16.04 (#7359)

* SUPERSET-8: Update text in docs copyright footer (#7360)

* SUPERSET-7: Docker compose config version breaks on Ubuntu 16.04

* SUPERSET-8: Extra text in docs copyright footer

* [schema] Adding commits and removing unnecessary foreign-key definitions (#7371)

*  Store last selected dashboard in sessionStorage (#7181)

* Store last selected dashboard in sessionStorage

* Fix tests

* [schema] Updating the base metric schema (#5453)

* Fix NoneType bug & fill the test recipients with original recipients if empty (#7365)

* feat: see Presto row and array data types (#7391)

* feat: see Presto row and array data types

* fix: address PR comments

* fix: lint and build issues

* fix: add types

* add stronger type hints where possible

* fix: lint issues and add select_star func in Hive

* add missing pkg init

* fix: build issues

* fix: pylint issues

* fix: use logging instead of print
2019-05-01 09:17:34 -07:00
Daniel Vaz Gaspar 06c4610e8e Bump FAB to 2.0.0 (#7323)
* Bump FAB to 2.0.0

* [tests] whitelist SecurityApi login and refresh endpoints

* [style] Fix, C812 missing trailing commas

* [security] Remove SUPERSET_UPDATE_PERMS flag

Registering sources needs to be performed after the views are
initialized on UPDATE_PERMS=False configuration

* [docs] New, FAB_UPDATE_PERMS and flask fab cli

* [docs] Fix, db upgrade needs to come first, create-admin needs a db

* [cli] New, superset init bootstraps all permissions for FAB and Superset

* [style] Fix, flakes
2019-04-30 09:01:18 -07:00
John Bodley f488a3281d
[schema] Updating the base metric schema (#5453) 2019-04-24 21:50:14 -07:00
John Bodley 1388452169
[schema] Updating the base column schema (#5452) 2019-04-23 18:06:21 -07:00
Maxime Beauchemin 36a219da7f
Allow Gamma and Alpha to access '/users/userinfo/' (#6936)
* Allow Gamma and Alpha to access '/users/userinfo/'

closes https://github.com/apache/incubator-superset/issues/4919

* Fix unit test

* Fix test
2019-04-22 11:23:54 -07:00
Maxime Beauchemin 5f28027ce7 Merging lyftga into master 2019-04-18 22:47:47 -07:00
michellethomas 51068f007e
Adding permission for can_only_access_owned_queries (#7234)
* Adding permission for can_only_access_owned_queries

* Fixing lint adding typing to variable

* Adding test for queryview and enabling /queryview/api/read

* Fixing issues with python typing
2019-04-17 16:11:11 -07:00
Maxime Beauchemin 9dfa80d5c8
Add all database access permission to 'Alpha' role (#7271)
* Add all database access permission to 'Alpha' role

* Grant all database access to Alpha
2019-04-15 09:22:54 -07:00
Beto Dealmeida 4ab89dbcf7 Celery task for warming up cache (#7148)
* Sparkline dates aren't formatting in Time Series Table (#6976)

* Exclude venv for python linter to ignore

* Fix NaN error

* Fix the white background shown in SQL editor on drag (#7021)

This PR sets the background-color css property on `.ace_scroller` instead of `.ace_content` to prevent the white background shown during resizing of the SQL editor before drag ends.

* Show tooltip with time frame (#6979)

* Fix time filter control (#6978)

* Enhancement of query context and object. (#6962)

* added more functionalities for query context and object.

* fixed cache logic

* added default value for groupby

* updated comments and removed print

(cherry picked from commit d5b9795f87)

* [fix] /superset/slice/id url is too long (#6989)


(cherry picked from commit 6a4d507ab6)

* [WIP] fix user specified JSON metadata not updating dashboard on refresh (#7027)


(cherry picked from commit cc58f0e661)

* feat: add ability to change font size in big number (#7003)

* Add ability to change font sizes in Big Number

* rename big number to header

* Add comment to clarify font size values

* Allow LIMIT to be specified in parameters (#7052)

* [fix] Cursor jumping when editing chart and dashboard titles (#7038)


(cherry picked from commit fc1770f7b7)

* Changing time table viz to pass formatTime a date (#7020)

(cherry picked from commit 7f3c145b1f)

* [db-engine-spec] Aligning Hive/Presto partition logic (#7007)


(cherry picked from commit 05be866117)

* [fix] explore chart from dashboard missed slice title (#7046)


(cherry picked from commit a6d48d4052)

* fix inaccurate data calculation with adata rolling and contribution (#7035)


(cherry picked from commit 0782e831cd)

* Adding warning message for sqllab save query (#7028)


(cherry picked from commit ead3d48133)

* [datasource] Ensuring consistent behavior of datasource editing/saving. (#7037)

* Update datasource.py

* Update datasource.py

(cherry picked from commit c771625f10)

* [csv-upload] Fixing message encoding (#6971)


(cherry picked from commit 48431ab5b9)

* [sql-parse] Fixing LIMIT exceptions (#6963)


(cherry picked from commit 3e076cb60b)

* Adding custom control overrides (#6956)

* Adding extraOverrides to line chart

* Updating extraOverrides to fit with more cases

* Moving extraOverrides to index.js

* Removing webpack-merge in package.json

* Fixing metrics control clearing metric

(cherry picked from commit e6194051f4)

* [sqlparse] Fixing table name extraction for ill-defined query (#7029)


(cherry picked from commit 07c340cf82)

* [missing values] Removing replacing missing values (#4905)


(cherry picked from commit 61add606ca)

* [SQL Lab] Improved query and results tabs rendering reliability (#7082)

closes #7080

(cherry picked from commit 9b58e9f492)

* Fix filter_box migration PR #6523 (#7066)

* Fix filter_box migration PR #6523

* Fix druid-related bug

(cherry picked from commit b210742ad2)

* SQL editor layout makeover (#7102)

This PR includes the following layout and css tweaks:
- Using flex to layout the north and south sub panes of query pane so resizing works properly in both Chrome and Firefox
- Removal of necessary wrapper divs and tweaking of css in sql lab so we can scroll to the bottom of both the table list and the results pane
- Make sql lab's content not overflow vertically and layout the query result area to eliminate double scroll bars
- css tweaks on the basic.html page so the loading animation appears in the center of the page across the board

(cherry picked from commit 71f1bbd2ec)

* [forms] Fix handling of NULLs

(cherry picked from commit e83a07d3df)

* handle null column_name in sqla and druid models

(cherry picked from commit 2ff721ae07)

* Use metric name instead of metric in filter box (#7106)


(cherry picked from commit 003364e74e)

* Bump python lib croniter to an existing version (#7132)

Package maintainers should really never delete packages, but it appears
this happened with croniter and resulted in breaking our builds.

This PR bumps to a more recent existing version of the library

(cherry picked from commit 215ed392a1)

* Revert PR #6933 (#7162)

* Celery worker for warming up cache

* Remove testing changes

* Add documentation

* Fix lint

* WIP dashboard filters

* Use new cache so it works with dashboards

* Add more unit tests, fix old ones

* Fix flake8 and docs

* Sparkline dates aren't formatting in Time Series Table (#6976)

* Exclude venv for python linter to ignore

* Fix NaN error

* Changing time table viz to pass formatTime a date (#7020)

(cherry picked from commit 7f3c145b1f)

* SQL editor layout makeover (#7102)

This PR includes the following layout and css tweaks:
- Using flex to layout the north and south sub panes of query pane so resizing works properly in both Chrome and Firefox
- Removal of necessary wrapper divs and tweaking of css in sql lab so we can scroll to the bottom of both the table list and the results pane
- Make sql lab's content not overflow vertically and layout the query result area to eliminate double scroll bars
- css tweaks on the basic.html page so the loading animation appears in the center of the page across the board

(cherry picked from commit 71f1bbd2ec)

* Celery worker for warming up cache

* Remove testing changes

* Add documentation

* Fix lint

* WIP dashboard filters

* Use new cache so it works with dashboards

* Add more unit tests, fix old ones

* Fix flake8 and docs

* Fix bad merge and pylint
2019-04-03 16:57:59 -07:00
Kim Truong e974a23f90 [Lyft-GA] Enable color consistency in a dashboard (#7135)
* Enable color consistency in a dashboard

Moved actions, minor UI, allowed dashboard copy

Fix linting errors

Undo unintentional change

Updated and added unit tests

Fail quietly if package has not been updated

Fail quietly on dashboard copy if package is old

* Update packages

* Remove unnecessary code

* Addressed Grace's comments

* Small fix for item key

* Reset chart's color during exploration

* Do not reset chart form data when exploring chart
2019-04-01 22:04:31 -07:00
Dave Smith ba19a62412 Injectable statsd client (#7138)
* Add ability to inject statsd client; some py test/reqs updates

- Updated the metrics logger to allow construction with an existing
statsd client, so that it can be configured by external systems or libs.
- added requirements to requirements-dev.txt which are needed to run
  tests-eg coverage, nose
- removed dependency on mock lib, it is in python stdlib now
- updated tox.ini to remove the now-superfluous deps

* add license to test file, and remove blank line at EOF
2019-03-27 14:08:36 -07:00
Ville Brofeldt 23e823f0c1 Bump SQLAlchemy to 1.3 (#7099)
* Bump sqla to >=1.3.1

* Refine mssql column types to only use N-prefixing when necessary

* make join explicit

* replace set with list

* Add additional test case for N-prefix

* Replace engine with dialect and fix linting error

* Remove unneeded import
2019-03-24 20:44:05 -07:00
Maxime Beauchemin b210742ad2
Fix filter_box migration PR #6523 (#7066)
* Fix filter_box migration PR #6523

* Fix druid-related bug
2019-03-20 21:41:33 -07:00
John Bodley 61add606ca
[missing values] Removing replacing missing values (#4905) 2019-03-20 17:14:15 -07:00
John Bodley 07c340cf82
[sqlparse] Fixing table name extraction for ill-defined query (#7029) 2019-03-15 09:19:30 -07:00
John Bodley 3e076cb60b
[sql-parse] Fixing LIMIT exceptions (#6963) 2019-03-05 09:36:08 -08:00
Maxime Beauchemin ed79134e7f
auto-set 'Is Temporal' to true where column_name == '__time' (#6857)
* auto-set 'Is Temporal' to true where column_name == '__time'

* Adress comments

* lint

* clarifying name and comments
2019-03-04 20:51:11 -08:00
Maxime Beauchemin 3ae02d1a54
Allow for dynamic feature flags (#6808)
* Allow for dynamic feature flags

Giving more control over feature flags, allowing administrator to define
custom logic around whether features are enabled for particular users /
roles.

The exposed function can be used for things like:
* progressive rollout of features (1%, 5%, 50%, 100%)
* experimentation
* role-based feature affectation (only admins see a particular feature)

* fix build

* Addressing comments

* Addressing @hughhh's comments
2019-02-27 15:11:38 -08:00
Ville Brofeldt ea9d22b2ec Force quotes on non-expression time grains on Postgres (#6897)
* Force quotes on non-expression time grains on postgres

* Change to or semantics

* Return lower case column name as unmutated

* Add testcases for postgres time grains

* Make expression MixedCase
2019-02-21 13:16:28 -08:00
Ville Brofeldt f5277fe684 Refactor dataframe and column name mutation logic (#6847)
* Merge dataframe and column name mutation logic, add flag for disabling column aliases and add column name length checking

* Remove custome mutate_label from oracle spec

* Move hashing from mutate_label() to make_label_compatible()

* Remove empty line

* Make label mutating and truncating more robust

* Rename variables and make proposed changes from review

* Always execute labels_expected codepath

* Fix linting error

* Add comments and fix subquery errors

* Refine column compatibility

* Simplify label assignment

* Add unit tests for BQ and Oracle

* Linting
2019-02-20 23:05:35 -08:00
michellethomas ba9523c7c4 Adding dropdown to DatasourceControl and ability to change datasource (#6816)
* Adding dropdown to DatasourceControl and ability to change datasource

* Style fixes

* Adding unit tests for datasource/get endpoint

* Fixing issue with dropdown overflow and style changes

* Fixing issues rebasing metadata button and fixing sort for datasource with no name
2019-02-20 14:32:33 -08:00
John Bodley 60d5f89faa
[main] Disable resetting main DB attributes (#6845) 2019-02-13 16:41:16 -08:00
Raphaël Merx 6e9130550d Add .standalone class to <body> when in standalone mode (#6811)
* Add .standalone class to <body> when in standalone mode

* Add test for .standalone class on <body>
2019-02-04 16:44:17 -08:00
Maxime Beauchemin 5a40f71710
[sql lab] improve table name detection in free form SQL (#6793)
* [sql lab] improve table name detection in free form SQL

* flake

* Addressing comments
2019-02-04 16:03:23 -08:00
agrawaldevesh fc4042a28b SelectControl hackery: Fixing freeform select and allowing group by and non group-by column selectors to take in arbitrary expressions including select-all semantics. (#6722)
Summary: We want to allow grouping by on expressions, including the
ability to select expressions (without group-by). The UI ain't good yet
.. it is not at the feature parity of say adhoc filters/metrics that
come with a nice text-box to edit the SQL. But
this suffices for my usecase for now.

(The UI would have to be redone ... but that would require some refactoring
to merge the AdhocFilter/Metric/Popover stuff such that it can be used
for this use case too.)

Also fixed a bug in the SelectControl freeForm selection.

Allow selecting all columns easily: Added a new Select-All special item
that users can select to make all the options in the selectable show
up.

The ability to group by arbitrary expressions is useful because now two
users don't need to create custom computed-fields for this.
2019-02-04 12:34:24 -08:00
Christine Chambers 19b3753d2c Move feature flag utility function into superset/__init__.py 2019-02-01 13:35:50 -08:00
Christine Chambers b70a9ae524 Merge default feature flags and user defined feature flags
- Rename the default feature flags key in `config.py` to DEFAULT_FEATURE_FLAGS
- Merge default feature flags with user defined ones allowing the latter to overwrite the former
- Expose feature_flags for both server and client to use
- Add a utility method for checking whether a feature flag is on on server side
2019-01-30 22:23:27 -08:00
Maxime Beauchemin 1ffee8b236
[cosmetic] remove 'List' prefix from list headers (#6725)
* [cosmetic] remove 'List' prefix from list headers

* Same change to connectors
2019-01-23 21:06:56 -08:00
bolkedebruin 1fece0d2fa Add licenses to translations (#6732)
* Add licenses

* More licenses

* Ignore messages.json as they are generated

* More licenses

* Also typescript

* Fix alignment

* Add to svg

* Many more licenses

* more licenses

* Better excludes

* Add licenses to docs and md files

* Pre-finalize licenses

* Fix newlines

* Finalize all sourde licenses

* Fix lint
2019-01-22 08:21:13 -08:00
Maxime Beauchemin f742b9876b
Making thrift, pyhive and tableschema as extra_requires (#6696)
* Making thrift, pyhive and tableschema as extra_requires

Looking at the dependency tree for license related questions, I noticed
that tableschema had a huge tree, and only people running Hive really
need it. Making this as well as pyhive and thrift optional.

Also bumping some python dependencies

* Run pip-compile

* Removing refs to past.builtins (from future lib)

* Add thrift
2019-01-19 14:27:18 -08:00
Maxime Beauchemin 75322ab12c
More ASF licenses (css + html/jinja) (#6711)
* More ASF licenses

* html

* removing from vendors
2019-01-17 22:39:00 -08:00
Maxime Beauchemin 6718588781
Add universal "New" button (#6670)
* [cosmetic] CRUD's list from 'Add Filter' to 'Filter Results'

* Add global new button

* A better viz type selector

* lint

* Move view to new module, add unit test

* 'Filter Results' -> 'Filter'

* db merge

* Filter -> 'Filter List'
2019-01-17 15:48:40 -08:00
Beto Dealmeida 99d6dc07d6
Trim query before parsing (#6703)
* Ignore empty lines

* Fix unit tests

* Use stripped

* Fix another unit test
2019-01-17 09:16:35 -08:00
Maxime Beauchemin 88964b7dfc
Deprecate auto-generated metrics (#5461)
* [WiP] deprecate auto-generated metrics & fix examples

Picking up some leftover pieces not needed anymore since the
MetricsControl

* db merge

* db merge

* fix migration

* Creating metrics required for tests
2019-01-16 22:32:13 -08:00
Maxime Beauchemin e03e276571
Bump some of the requirements-dev.txt (#6700)
* Bump some of the requirements-dev.txt

* addressing comments
2019-01-16 20:40:16 -08:00
Maxime Beauchemin 1dd4d7a587
Apply ASF licenses throughout the code base (#5800)
* Add license headers

* reabased

* lint

* Removing licenses from vendors folder
2019-01-15 15:53:27 -08:00
Maxime Beauchemin da813b7ee3
[table editor] allow selecting physical table (#6046)
* [table editor] allow selecting physical table

* Using classes for padding
2019-01-15 08:53:24 -08:00
Chinh Nguyen 284a0cccd3 Add fix for pyodbc+mssql (#6621)
* add fix for odbc+mssql

* fix for pylint/pep8
2019-01-13 09:30:05 -08:00
Maxime Beauchemin fe77b57581
[refactor] moving some datasource-related code to the frontend (#5769)
* [refactor] moving some datasource-related code to the frontend

* fix js tests

* fix tests

* fix test
2018-12-22 18:06:36 -08:00
Maxime Beauchemin d427db0a8b [SQL Lab] Allow running multiple statements (#6112)
* Allow running multiple statements from SQL Lab

* fix tests

* More tests

* merge heads

* fix heads
2018-12-22 10:28:22 -08:00
Maxime Beauchemin 3f29a1dd70
Secure unsecured views and prevent regressions (#6553)
* Secure views and prevent regressions

* Force POST on shortner

* Fix tests
2018-12-18 11:57:13 -08:00
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
John Bodley 7fcc2af68f
[sql] Correct SQL parameter formatting (#5178) 2018-07-21 12:01:26 -07:00
gbates101 90decbc5db Migrated to click (#5410)
* Migrate flask_script to the Flask built-in click.

Flask 0.11 is the built-in integration of the click command line interface.
Flask-Migrate support for the new Flask CLI based on Click after Release 2.0.0.

* Resolved merge conflicts.

* Fixed issue introduced from bad merge.

* Fixed flake8 errors, added build to excluded flake8 stuff.

* * Moved the FlaskGroup declaration to the driver script.
* Moved shell context definition to cli.py
* Switched shell context definition to use decorator.
* Moved create_app definition to cli.py
* Fixed InvocationError with a wrapped function

* Added extra newlines between functions

* Removed flask-script dependency.
2018-07-20 15:26:33 -07:00
timifasubaa f8a6e09220
[sqllab] Fix sqllab limit regex issue with sqlparse (#5295)
* include items after limit to the modified query

* use sqlparse
2018-07-16 15:27:30 -07:00
Beto Dealmeida 4fa416347d Make time filter more usable (#4981)
* Initial work

* WIP

* WIP

* Working

* WIP

* Still WIP

* Frontend done

* Working version

* Migration working

* Migration working

* Fix freeform rerender

* Remove jquery

* Fix filter

* Unit tests and lint

* Fix py.test

* Improve unit tests

* Ensure freeform is computed at init

* Fix lint

* Trying to fix pyfreeze error

* Remove freezegun

* Address comments

* Use tabs instead of pills

* Regroup options

* WIP

* Change type when clicking calendar

* Fix CSS

* Fix JS lint
2018-07-16 14:27:40 -07:00
Maxime Beauchemin 709f056445
[bugfix] make MetricsControl work with DECK visualizations (#5376)
* [bugfix] make MetricsControl work with DECK visualizations

* Add unit tests
2018-07-16 13:42:07 -07:00
JamshedRahman cafde1536f Adding Druid Time Granularities (#5379)
* Adding Druid Time Granularities

* fixed a linter error
2018-07-12 10:19:50 -04:00
John Bodley 72d815c0f9
[cache] Allowing zero cache-timeout (#5315) 2018-07-02 15:32:21 -07:00
Grace Guo ad05700b6b [dashboard fix]Fix copy_dash unit test (#5323) 2018-07-01 08:47:57 -07:00
Maxime Beauchemin 777d876a52
Improve database type inference (#4724)
* Improve database type inference

Python's DBAPI isn't super clear and homogeneous on the
cursor.description specification, and this PR attempts to improve
inferring the datatypes returned in the cursor.

This work started around Presto's TIMESTAMP type being mishandled as
string as the database driver (pyhive) returns it as a string. The work
here fixes this bug and does a better job at inferring MySQL and Presto types.
It also creates a new method in db_engine_specs allowing for other
databases engines to implement and become more precise on type-inference
as needed.

* Fixing tests

* Adressing comments

* Using infer_objects

* Removing faulty line

* Addressing PrestoSpec redundant method comment

* Fix rebase issue

* Fix tests
2018-06-27 21:35:12 -07:00
Grace Guo 17b4298401
[dashobard fix]: fix validation check for default_filters (#5297) 2018-06-27 11:00:50 -07:00
John Bodley 117507cf31
[get_df] Fix datetime conversion (#5274) 2018-06-27 09:09:42 -07:00
Chris Williams c065319508
[wip] dashboard builder v2 (#4528)
* [dashboard builder] Add dir structure for dashboard/v2, simplified Header, split pane, Draggable side panel

[grid] add <DashboardGrid />, <ResizableContainer />, and initial grid components.

[grid] gridComponents/ directory, add fixtures/ directory and test layout, add <Column />

[grid] working grid with gutters

[grid] design tweaks and polish, add <Tabs />

[header] add gradient header logo and favicon

[dnd] begin adding dnd functionality

[dnd] add util/isValidChild.js

[react-beautiful-dnd] iterate on dnd until blocked

[dnd] refactor to use react-dnd

[react-dnd] refactor to use composable <DashboardComponent /> structure

[dnd] factor out DashboardComponent, let components render dropInidcator and set draggableRef, add draggable tabs

[dnd] refactor to use redux, add DashboardComponent and DashboardGrid containers

[dragdroppable] rename horizontal/vertical => row/column

[builder] refactor into HoverMenu, add WithPopoverMenu

[builder] add editable header and disableDragDrop prop for Dragdroppable's

[builder] make tabs editable

[builder] add generic popover dropdown and header row style editability

[builder] add hover rowStyle dropdown, make row styles editable

[builder] add some new component icons, add popover with delete to charts

[builder] add preview icons, add popover menu to rows.

[builder] add IconButton and RowStyleDropdown

[resizable] use ResizableContainer instead of DimensionProvider, fix resize and delete bugs

[builder] fix bug with spacer

[builder] clean up, header.size => header.headerSize

[builder] support more drag/drop combinations by wrapping some components in rows upon drop. fix within list drop index. refactor some utils.

[builder][tabs] fix broken add tab button

[dashboard builder] don't pass dashboard layout to all dashboard components, improve drop indicator logic, fix delete component pure component bug

[dnd] refactor drop position logic

* fix rebase error, clean up css organization and use @less vars

* [dashboard-builder] add top-level tabs + undo-redo (#4626)

* [top-level-tabs] initial working version of top-level tabs

* [top-level-tabs] simplify redux and disable ability to displace top-level tabs with other tabs

* [top-level-tabs] improve tab drag and drop css

* [undo-redo] add redux undo redo

* [dnd] clean up dropResult shape, add new component source id + type, use css for drop indicator instead of styles and fix tab indicators.

* [top-level-tabs] add 'Collapse tab content' to delete tabs button

* [dnd] add depth validation to drag and drop logic

* [dashboard-builder] add resize action, enforce minimum width of columns, column children inherit column size when necessary, meta.rowStyle => meta.background, add background to columns

* [dashboard-builder] make sure getChildWidth returns a number

* [dashboard builder] static layout + toasts (#4763)

* [dashboard-builder] remove spacer component

* [dashboard-builder] better transparent indicator, better grid gutter logic, no dragging top-level tabs, headers are multiples of grid unit, fix row height granularity, update redux state key dashboard => dashboardLayout

* [dashboard-builder] don't blast column child dimensions on resize

* [dashboard-builder] ResizableContainer min size can't be smaller than size, fix row style, role=none on WithPopoverMenu container

* [edit mode] add edit mode to redux and propogate to all <DashboardComponent />s

* [toasts] add Toast component, ToastPresenter container and component, and toast redux actions + reducers

* [dashboard-builder] add info toast when dropResult overflows parent

* [dashboard builder] git mv to src/ post-rebase

* Dashboard builder rebased + linted (#4849)

* define dashboard redux state

* update dashboard state reducer

* dashboard layout converter + grid render

* builder pane + slice adder

* Dashboard header + slice header controls

* fix linting

* 2nd code review comments

* [dashboard builder] improve perf (#4855)

* address major perf + css issues

[dashboard builder] fix dashboard filters and some css

[dashboard builder] use VIZ_TYPES, move stricter .eslintrc to dashboard/, more css fixes

[builder] delete GridCell and GridLayout, remove some unused css. fix broken tabs.

* [builder] fix errors post-rebase

* [builder] add support for custom DragDroppable drag layer and add AddSliceDragPreview

* [AddSliceDragPreview] fix type check

* [dashboard builder] add prettier and update all files

* [dashboard builder] merge v2/ directory int dashboard/

* [dashboard builder] move component/*Container => containers/*

* add sticky tabs + sidepane, better tabs perf, better container hierarchy, better chart header (#4893)

* dashboard header, slice header UI improvement

* add slider and sticky

* dashboard header, slice header UI improvement

* make builder pane floating

* [dashboard builder] add sticky top-level tabs, refactor for performant tabs

* [dashboard builder] visually distinct containers, icons for undo-redo, fix some isValidChild bugs

* [dashboard builder] better undo redo <> save changes state, notify upon reaching undo limit

* [dashboard builder] hook up edit + create component actions to saved-state pop.

* [dashboard builder] visual refinement, refactor Dashboard header content and updates into layout for undo-redo, refactor save dashboard modal to use toasts instead of notify.

* [dashboard builder] refactor chart name update logic to use layout for undo redo, save slice name changes on dashboard save

* add slider and sticky

* [dashboard builder] fix layout converter slice_id + chartId type casting, don't change grid size upon edit (perf)

* [dashboard builder] don't set version key in getInitialState

* [dashboard builder] make top level tabs addition/removal undoable, fix double sticky tabs + side panel.

* [dashboard builder] fix sticky tabs offset bug

* [dashboard builder] fix drag preview width, css polish, fix rebase issue

* [dashboard builder] fix side pane labels and hove z-index

* Markdown for dashboard (#4962)

* fix dashboard server-side unit tests (#5009)

* Dashboard save button (#4979)

* save button

* fix slices list height

* save custom css

* merge save-dash changes from dashboard v1
https://github.com/apache/incubator-superset/pull/4900
https://github.com/apache/incubator-superset/pull/5051

* [dashboard v2] check for default_filters before json_loads-ing them (#5064)

[dashboard v2] check for default_filters before json-loads-ing them

* [dashboard v2] fix bugs from rebase

* [dashboard v2] tests! (#5066)

* [dashboard v2][tests] add tests for newComponentFactory, isValidChild, dropOverflowsParent, and dnd-reorder

* [dashboard v2][tests] add tests for componentIsResizable, findParentId, getChartIdsFromLayout, newEntitiesFromDrop, and getDropPosition

* [dashboard v2][tests] add mockStore, mockState, and tests for DragDroppable, DashboardBuilder, DashboardGrid, ToastPresenter, and Toast

* [dashboard builder][tests] separate files for state tree fixtures, add ChartHolder, Chart, Divider, Header, Row tests and WithDragDropContext helper

* [dashboard v2][tests] fix dragdrop context with util/getDragDropManager, add test for menu/* and resizable/*, and new components

* [dashboard v2][tests] fix and re-write Dashboard tests, add getFormDataWithExtraFilters_spec

* [dashboard v2][tests] add reducer tests, fix lint error

* [dashboard-v2][tests] add actions/dashboardLayout_spec

* [dashboard v2] fix some prop bugs, open side pane on edit, fix slice name bug

* [dashboard v2] fix slice name save bug

* [dashboard v2] fix lint errors

* [dashboard v2] fix filters bug and add test

* [dashboard v2] fix getFormDataWithExtraFilters_spec

* [dashboard v2] logging updates (#5087)

* [dashboard v2] initial logging refactor

* [dashboard v2] clean up logger

* [logger] update explore with new log events, add refresh dashboard + refresh dashboard chart actions

* [logging] add logger_spec.js, fix reducers/dashboardState_spec + gridComponents/Chart_spec

* [dashboard v2][logging] refactor for bulk logging in python

* [logging] tweak python, fix and remove dup start_offset entries

* [dashboard v2][logging] add dashboard_first_load event

* [dashboard v2][logging] add slice_ids to dashboard pane load event

* [tests] fix npm test script

* Fix: update slices list when add/remove multiple slices (#5138)

* [dashboard v2] add v1 switch (#5126)

* [dashboard] copy all dashboard v1 into working v1 switch

* [dashboard] add functional v1 <> v2 switch with messaging

* [dashboard] add v2 logging to v1 dashboard, add read-v2-changes link, add client logging to track v1 <> v2 switches

* [dashboard] Remove default values for feedback url + v2 auto convert date

* [dashboard v2] fix misc UI/UX issues

* [dashboard v2] fix Markdown persistance issues and css, fix copy dash title, don't enforce shallow hovering with drop indicator

* [dashboard v2] improve non-shallow drop target UX, fix Markdown drop indicator, clarify slice adder filter/sort

* [dashboard v2] delete empty rows on drag or delete events that leave them without children, add test

* [dashboard v2] improve v1<>v2 switch modals, add convert to v2 badge in v1, fix unsaved changes issue in preview mode, don't auto convert column child widths for now

* [dashboard v2][dnd] add drop position cache to fix non-shallow drops

* [dashboard] fix test script with glob instead of recurse, fix tests, add temp fix for tab nesting, ignore v1 lint errors

* [dashboard] v2 badge style tweaks, add back v1 _set_dash_metadata for v1 editing

* [dashboard] fix python linting and tests

* [dashboard] lint tests

* add slice from explore view (#5141)

* Fix dashboard position row data (#5131)

* add slice_name to markdown

(cherry picked from commit 14b01f1)

* set min grid width be 1 column

* remove empty column

* check total columns count <= 12

* scan position data and fix rows

* fix dashboard url with default_filters

* [dashboard v2]  better grid drop ux, fix tab bugs 🐛 (#5151)

* [dashboard v2] add empty droptarget to dashboard grid for better ux and update test

* [dashboard] reset tab index upon top-level tab deletion, fix findparentid bug

* [dashboard] update v1<>v2 modal link for tracking

* Fix: Should pass slice_can_edit flag down (#5159)

* [dash builder fix] combine markdown and slice name, slice picker height (#5165)

* combine markdown code and markdown slice name

* allow dynamic height for slice picker cell

* add word break for long datasource name

* [fix] new dashboard state (#5213)

* [dashboard v2] ui + ux fixes (#5208)

* [dashboard v2] use <Loading /> throughout, small loading gif, improve row/column visual hierarchy, add cached data pop

* [dashboard v2] lots of polish

* [dashboard v2] remove markdown padding on edit, more opaque slice drag preview, unsavedChanges=true upon moving a component, fix initial load logging.

* [dashboard v2] gray loading.gif, sticky header, undo/redo keyboard shortcuts, fix move component saved changes update, v0 double scrollbar fix

* [dashboard v2] move UndoRedoKeylisteners into Header, render only in edit mode, show visual feedback for keyboard shortcut, hide hover menu in top-level tabs

* [dashboard v2] fix grid + sidepane height issues

* [dashboard v2] add auto-resize functionality, update tests. cache findParentId results.

* [dashboard v2][tests] add getDetailedComponentWidth_spec.js

* [dashboard v2] fix lint

* [fix] layout converter fix (#5218)

* [fix] layout converter fix

* add changed_on into initial sliceEntity data

* add unit tests for SliceAdder component

* remove old fixtures file

* [dashboard v2] remove webpack-cli, fresh yarn.lock post-rebase

* [dashboard v2] lint javascript

* [dashboard v2] fix python tests

* [Fix] import/export dash in V2 (#5273)

* [dashboard v2] add markdown tests (#5275)

* [dashboard v2] add Markdown tests

* [dashboard v2][mocks] fix markdown mock
2018-06-25 09:17:22 -07:00
Jeffrey Wang 2a3d297950 Allow users to view dashboards they own (#4520)
* Allow owners to view their own dashboards

* Update docstring

* update sm variable

* Add unit test

* misc linter
2018-06-20 12:08:16 -07:00
Yuance.Li 7f30b48955 fetch datasources from broker endpoint when refresh new datasources (#5183)
* fetch datasources from broker endpoint when refresh new datasources

* remove get_base_coordinator_url as out of use

* add broker_endpoint in get_test_cluster_obj
2018-06-13 08:10:58 -07:00
Tamika Tannis dc21e0dd78 URL shortner for dashboards (#4760)
* Added support for URLShortLinkButton to work for the dashboard case

* Fix lint errors and test

* Change references to 'slice' to 'chart'.

* Add unit tests to improve coverage

* Fixing lint errors

* Refactor to make URLShortLink more generic. Remove history modification code, redirect should be handling this.

* Remove history modification code, redirect should be handling this

* Generate a shorter link without the directory, and delegate default linked to the contents of window.location

* Fix lint errors

* Fix test_shortner test to check for new pattern

* Remove usage of addHistory to manipulate explore shortlink redirection

* Address build failure and using better practices for shortlink defaults

* Fixing alphabetical order

* More syntax mistakes

* Revert explore view history changes

* Fix use of component props, & rebase
2018-06-02 11:08:43 -07:00
timifasubaa cefc206a36
Merge pull request #5023 from timifasubaa/fix_sqllab_commit
[sqllab] force limit queries only when there is no existing limit
2018-05-31 11:12:46 -07:00
Timi Fasubaa a9d7fafd9f add tests 2018-05-30 12:50:27 -07:00
John Bodley 0511d1f38d
[get_df] Adding support for multi-statement SQL (#5086) 2018-05-29 14:20:17 -07:00
Timi Fasubaa d38315a307 reuse_regex_logic 2018-05-25 15:07:27 -07:00
Timi Fasubaa 1aced9b562 force limit only when there is no existing limit 2018-05-25 14:54:11 -07:00
John Bodley 3207116535
Revert "[get_df] Adding support for multi-statement SQL" (#5078) 2018-05-24 14:59:34 -07:00
John Bodley 17d6464aa9
[get_df] Adding support for multi-statement SQL (#5060) 2018-05-23 11:40:25 -07:00
Beto Dealmeida 973c661501 Rename "slice" to "chart" and update translations (#5008)
* Rename slice to chart and update translations

* Fix unit tests
2018-05-21 17:49:02 -07:00
Beto Dealmeida 459cb701fb Visualization for multiple line charts (#4819)
* Initial test

* Save

* Working version

* Use since/until from payload

* Option to prefix metric name

* Rename LineMultiLayer to MultiLineViz

* Add more styles

* Explicit nulls

* Add more x controls

* Refactor to reuse nvd3_vis

* Fix x ticks

* Fix spacing

* Fix for druid datasource

* Rename file

* Small fixes and cleanup

* Fix margins

* Add proper thumbnails

* Align yaxis1 and yaxis2 ticks

* Improve code

* Trigger tests

* Move file

* Small fixes plus example

* Fix unit test

* Remove SQL and Filter sections
2018-05-21 17:47:21 -07:00
Gabe Lyons 1c9474b4ff treating floats like doubles for druid versions lower than 11.0.0 (#5030) 2018-05-21 11:50:04 -07:00
Yongjie Zhao 9f66dae328 [bugfix] Fix ZeroDivisionError and get metrics label with percent metrics (#5026)
* Fix percent_metrics ZeroDivisionError and can not get metrics with label issue

* convert iterator to list

* get percentage metrics with get_metric_label method

* Adding tests case for expression type metrics

* Simplify expression
2018-05-20 11:10:57 -05:00
Maxime Beauchemin b839608c32
[sql lab] a better approach at limiting queries (#4947)
* [sql lab] a better approach at limiting queries

Currently there are two mechanisms that we use to enforce the row
limiting constraints, depending on the database engine:
1. use dbapi's `cursor.fetchmany()`
2. wrap the SQL into a limiting subquery

Method 1 isn't great as it can result in the database server storing
larger than required result sets in memory expecting another fetch
command while we know we don't need that.

Method 2 has a positive side of working with all database engines,
whether they use LIMIT, ROWNUM, TOP or whatever else since sqlalchemy
does the work as specified for the dialect. On the downside though
the query optimizer might not be able to optimize this as much as an
approach that doesn't use a subquery.

Since most modern DBs use the LIMIT syntax, this adds a regex approach
to modify the query and force a LIMIT clause without using a subquery
for the database that support this syntax and uses method 2 for all
others.

* Fixing build

* Fix lint

* Added more tests

* Fix tests
2018-05-14 14:44:05 -05:00
Ville Brofeldt b391676544 Force lowercase column names for Snowflake and Oracle (#4994)
* Force lowercase column names for Snowflake and Oracle

* Force lowercase column names for Snowflake and Oracle

* Remove lowercasing of DB2 columns

* Remove DB2 lowercasing

* Fix test cases
2018-05-14 13:43:13 -05:00
Gabe Lyons a8514b267b [Explore] Adding Adhoc Filters (#4909)
* adding custom expressions to adhoc metrics

* adjusted transitions and made the box expandable

* adding adhoc filters

* adjusted based on feedback
2018-05-10 10:41:10 -07:00
jasnovak e29beba023 Add extraction function support for Druid queries (#4740)
* add extraction fn support for Druid queries

* bump pydruid version to get extraction fn commits

* update and add tests for druid for filters with extraction fns

* conform to flake8 rules

* fix flake8 issues

* bump pyruid version for extraction function features
2018-05-08 22:00:06 -07:00
John Bodley 440fb77df5
[druid] Updating Druid refresh metadata tests (#4887) 2018-05-03 18:14:40 -07:00
Maxime Beauchemin 3f48c005df
[bugfix] temporal columns with expression fail (#4890)
* [bugfix] temporal columns with expression fail

error msg: "local variable 'literal' referenced before assignment"

Error occurs [only] when using temporal column defined as a SQL
expression.

Also noticed that examples were using `granularity` instead of using
`granularity_sqla` as they should. Fixed that here.

* Add tests
2018-04-26 21:13:52 -07:00
Maxime Beauchemin a98c3cfdef
Fix time granularity-related issues (#4821)
* Fixing time grain

* Add tests
2018-04-18 16:17:28 -07:00
Maxime Beauchemin eac97ce9f2
[explore] proper filtering of NULLs and '' (#4651)
* [WiP] [explore] proper filtering of NULLs and ''

TODO: handling of Druid equivalents

* Unit tests

* Some refactoring

* [druid] fix 'Unorderable types' when col has nuls

Error "unorderable types: str() < int()" occurs when grouping by a
numerical Druid colummn that contains null values.

* druid/pydruid returns strings in the datafram with NAs for nulls
* Superset has custom logic around get_fillna_for_col that fills in the
NULLs based on declared column type (FLOAT here), so now we have a mixed
bag of type in the series
* pandas chokes on pivot_table or groupby operations as it cannot sorts
mixed types

The approach here is to stringify and fillna('<NULL>') to get a
consistent series.

* typo

* Fix druid_func tests

* Addressing more comments

* last touches
2018-04-17 22:26:21 -07:00
John Bodley 2900ca345d
[travis] Fixing environments (#4828) 2018-04-15 16:21:33 -07:00
Gabe Lyons 8669874ec6 [Explore] Adding custom expressions to adhoc metrics (#4736)
* adding custom expressions to adhoc metrics

* adjusted transitions and made the box expandable
2018-04-13 11:20:53 -07:00
Hugh A. Miles II 2f5cff7d9f [DeckGL] Added fixtures and Deck test (#4798)
* added fixtures and deck test

* linting

* linting

* add os.path

* remove para

* fix reference
2018-04-12 17:20:39 -07:00
John Bodley dadc0574b8
[tests] cleaning up test configuration (#4806) 2018-04-11 14:09:20 -07:00
michellethomas 725b8f94c9 Adding tests for the time table viz (#4659) 2018-04-11 13:24:51 -07:00
John Bodley 7f1d7543d0
[logs] Dropping dt column (#4587) 2018-04-10 18:34:32 -07:00
John Bodley 1627fd096b
[travis/tox] Restructuring configuration (#4552) 2018-04-10 15:59:44 -07:00
Maxime Beauchemin 627bdb2eb3
[dashboard] open in edit mode when adding a chart (#4772)
* [dashboard] open in edit mode when adding a chart

* Move dashboard unit tests to their own file

* fix tests

* Better URL management
2018-04-07 12:55:05 -07:00
John Bodley df4ff05441
[druid] Excluding refreshing verbose name (#4761) 2018-04-04 17:16:53 -07:00
Maxime Beauchemin 3b7e0a951a
[sql lab] preserve schema through visualize flow (#4742)
* [sql lab] preserve schema through visualize flow

https://github.com/apache/incubator-superset/pull/4696 got tangled
into refactoring views out of views/core.py and onto views/sql_lab.py

This is the same PR without the refactoring.

* Fix lint
2018-04-04 13:38:37 -07:00
Maxime Beauchemin f6fe11f76e
[bugfix] convert metrics to numeric in dataframe (#4726)
* [bugfix] convert metrics to numeric in dataframe

It appears sometimes the dbapi driver and pandas's read_sql fail at
returning the proper numeric types for metrics and they show up as
`object` in the dataframe. This results in "No numeric types to
aggregate" errors when trying to perform aggregations or pivoting in
pandas.

This PR looks for metrics in dataframes that are typed as "object"
and uses pandas' to_numeric to convert.

* Fix tests

* Remove all iteritems
2018-04-02 21:48:14 -07:00
Jeffrey Wang 8be0bde683 [BugFix] Allowing limit ordering by post-aggregation metrics (#4646)
* Allowing limit ordering by post-aggregation metrics

* don't overwrite og dictionaries

* update tests

* python3 compat

* code review comments, add tests, implement it in groupby as well

* python 3 compat for unittest

* more self

* Throw exception when get aggregations is called with postaggs

* Treat adhoc metrics as another aggregation
2018-04-02 21:37:00 -07:00
Gabe Lyons 68dec24542 [Explore] Streamlined metric definitions for SQLA and Druid (#4663)
* adding streamlined metric editing

* addressing lint issues on new metrics control

* enabling druid
2018-03-28 17:41:29 -07:00
timifasubaa 8dd052de4b [security] Refactor security code into SupersetSecurityManager (#4565)
* move access permissions methods to security manager

* consolidate all security methods into SupersetSecurityManager

* update security method calls

* update calls from tests

* move get_or_create_main_db to utils

* raise if supersetsecuritymanager is not extended

* rename sm to security_manager
2018-03-27 16:46:02 -07:00
John Bodley f9d85bd2e1
[druid] Updating refresh logic (#4655) 2018-03-26 18:35:43 -07:00
Riccardo Magliocchetti 76394d3f8f forms: make csv import parse dates accepts a list of columns (#4639)
Instead of a boolean which has way less chances to work. While
at it add a proper label for the "con" field.

Fixes #4637
2018-03-23 14:16:02 -07:00
Jeffrey Wang 33aa976e3d Cache the query string (#4633)
* Cache the query string

* misc linter
2018-03-21 13:13:36 -07:00
michellethomas 5c98f5642b Fix sqllab numpy array (#4629)
* Fixing error with sqllab numpy array

* Adding tests for failing sqllab data type
2018-03-19 11:43:04 -07:00
Maxime Beauchemin 93ec76f757
[sql lab] reduce the number of metadata calls when loading a table (#4593) 2018-03-15 17:53:34 -07:00
Hugh A. Miles II 2bc089ef8d Added new exception class and start of better exception/error handling (#4514)
* rebase and linting

* change back

* wip

* fixed broken test

* fix flake8

* fix test
2018-03-11 22:07:51 -07:00
Grace Guo 9edbd64c5d
[Explore] Save custom url parameters when user save slices (#4578)
* [Explore] Save url parameters when user save slices

* remove print

(cherry picked from commit bd9ecbe)

* add unit test

(cherry picked from commit 0f350ad)

* wrapping all request params into url_params

(cherry picked from commit 17197c1)
2018-03-08 13:19:41 -08:00
John Bodley ef4e5ecedf [bugfix] Fixing regression from #4500 (#4549) 2018-03-06 21:19:13 -08:00
John Bodley 48430a1918
Merge pull request #4500 from john-bodley/john-bodley-fix-pr-4396
[bugfix] Fixing regression introduced in #4396
2018-03-05 16:51:09 -08:00
John Bodley 7440d34936 [payload] Fixing regression introducted in ##4396 2018-02-28 14:23:20 -08:00
Maxime Beauchemin 849a2cecee
Add https support for Druid (#4480)
* Add https support for Druid

* addressing comment
2018-02-28 10:12:17 -08:00
Maxime Beauchemin 83524f97d7 [WiP] Cleanup & fix URL scheme for the explore view (#4490)
* Improve URLs

* Fix js tests
2018-02-27 15:08:06 -08:00
John Bodley d57a37e341 [flake8] Adding flake8-coding (#4477) 2018-02-25 15:06:11 -08:00
John Bodley e112e4417c [flake8] Adding future-import check (#4476) 2018-02-23 16:42:09 -08:00
John Bodley 8aac63e74c [flake8] Fixing additional flake8 issue w/ the presence of ignore (#4474) 2018-02-23 14:46:26 -08:00
Ville Brofeldt d6c197f8ac Remove comments from queries in SQL Lab that break Explore view (#4413)
* Remove comments from queries in SQL Lab that break Explore view

This fixes an issue where comments on the last line of the source query comment out the closing parenthesis of the subquery.

* Add test case for SqlaTable with query with comment

This test ensures that comments in the query are removed when calling SqlaTable.get_from_clause().

* Add missing blank line class definition (PEP8)
2018-02-18 16:30:11 -08:00
timifasubaa fa0aa33767 Disable user access request (#4405)
* add feature flag to config

* wrap check around a feature flag

* add flag to the model view

* remove access request from seurity tests
2018-02-14 14:49:22 -08:00
Grace Guo 342180b263
[Explore view] Use POST method for charting requests (#3993)
* [Explore view] Use POST method for charting requests

* fix per code review comments

* more code review fixes

* code review fix: remove duplicated calls for getting values from request

* [Explore view] Use POST method for charting requests

* fix per code review comments

* more code review fixes

* code review fix: remove duplicated calls for getting values from request
2018-02-13 17:21:15 -08:00
michellethomas 19a0827d1f Adding dashboard add view (#4344)
* Adding DashboardAddView and setting show_columns on SLiceAddView

* Adding tests for sliceaddview read api

* Dedupe show_columns
2018-02-06 12:38:07 -08:00
timifasubaa 6d37d97ba5 Refactor import csv (#4298)
* move helpers to utils

* make form use queryselector

* refactor exception throwing and handling

* update db_connection access point

* nits
2018-02-03 20:22:06 -08:00
Jeff Niu fdd42ef4b6 [New Viz] Nightingale Rose Chart (#3676)
* Nightingale Rose Chart

* Review comments
2018-02-03 20:18:24 -08:00
Maxime Beauchemin e4a95f9428
Use the query_obj as the basis for the cache key (#4260)
* Use the query_obj as the basis for the cache key

When we recently moved from hashing form_data to define the cache_key
towards using the rendered query instead,
it made is such that non deterministic form
control values like relative times specified in "from" and "until" time
bound resulted in making those miss cache 100% of the time.

Here we move away from using the rendered query and using the query_obj
instead.

* Deprecating using form_data in templates
2018-01-28 09:46:13 -08:00
Marcus Levine 4bc5fe5495 [BUGFIX]: Check datatype of results before converting to DataFrame (#4108)
* conditional check on datatype of results before converting to df

fix type checking

fix conditional checks

remove trailing whitespace and fix df_data fallback def

actually remove trailing whitespace

generalized type check to check all columns for dict

refactor dict col check

* move df conversion to helper and add unit test

add missing newlines

another missing newline

fix quotes

more quote fixes
2018-01-23 20:58:06 -08:00
timifasubaa 2c72a7ae4f Use json for imports and exports, not pickle (#4243)
* make superset imports and exports use json, not pickle

* fix tests
2018-01-23 20:55:27 -08:00
John Bodley a7a6678d5c [cache] Using the query as the basis of the cache key (#4016) 2018-01-12 12:05:12 -08:00
fabianmenges 23c98294bd Moving the custom_password_store out of Database class (#4182) 2018-01-09 13:14:20 -08:00
Maxime Beauchemin 37205099db
Fix USA's state geojson for 'Country Map' visualization (#4121)
* Fix USA's state geojson for 'Country Map' visualization

Turns out the ISO codes were missing from the geojson file, this adds it
and uses human-readable indents.

* using proper ISO codes

* Linting

New linting rules started applying, I'm guessing a new version of
pylint?
2018-01-02 20:21:33 -08:00
Nicolas Bonnotte b4909f2d03 [Bugfix] Issues with merge_extra_filters (#4042) (#4091) 2017-12-20 16:22:43 -08:00
Jeff Niu af7cdeba4d [Feature] enhanced memoized on get_sqla_engine and other functions (#3530)
* added watch to memoized

* added unit tests for memoized

* code style changes
2017-12-17 10:35:00 -08:00
fabianmenges 500e6256c0 Full Annotation Framework (#3518)
* Adding full Annotation Framework

* Viz types

* Re organizing native annotations

* liniting

* Bug fix

* Handle no data

* Cleanup

* Refactor slice form_data to data
2017-12-16 16:10:45 -08:00
Maxime Beauchemin ec752b1378
[geo] provide more flexible Spatial controls (#4032)
Before this PR the only way to query lat/long is in the shape of 2
columns that contains lat and long.

Now we're adding 2 more options:
* a single column that has lat and long with a delimiter in between
* support for geohashes - geohashes are cool
2017-12-15 11:47:27 -08:00
Hugh A. Miles II c84211ec44 Change reference for slices to chart (#4049)
* change reference for slices to chart

* change profile page reference

* change reference for Associated Slices

* change back to single quotes

* fix other single quotes

* linting

* last one

* fix test
2017-12-12 18:02:17 -08:00
Jeff Niu 7d374428d3 [Bugfix] _add_filters_from_pre_query doesn't handle dim specs (#3974)
* Fixed _add_filters_from_pre_query for dimension specs

* add_filters_from_pre_query ignores extraction functions
2017-12-11 12:35:25 -08:00
John Bodley 3a2974f589 [API] Deprecate /update_role/ API endpoint (#4041) 2017-12-10 21:14:15 -08:00
Jeff Niu cb7c5aa70c Fixed finding postaggregations (#4017) 2017-12-06 21:55:43 -08:00
fabianmenges 72627b1761 Adding YAML Import-Export for Datasources to CLI (#3978)
* Adding import and export for databases

* Linting
2017-12-05 11:14:52 -08:00
michellethomas 9904593dc3 Improving speed of dashboard import (#3958)
* Improve dashboard import

* Updating tests for Slice.import_obj
2017-11-30 20:47:22 -08:00
Jeff Niu 8f00e9e30b [Bugfix] Druid `run_query` dimensions part 3 + Unit tests (#3949)
* Fixed and added tests for druid run query

* Fixes style and python3
2017-11-30 20:32:53 -08:00
timifasubaa 268edcfedd Import CSV (#3643)
* add upload csv button to sources dropdown

* upload csv to non-hive datasources

* upload csv to hive datasource

* update FAQ page

* add tests

* fix linting errors and merge conflicts

* Update .travis.yml

* Update tox.ini
2017-11-27 21:07:12 -08:00
bolkedebruin 4ae77ba8af Workaround pandas bug in datetimes with time zones (#3910)
A bug in to_dict(orient="records") in pandas/core/frame.py prevents
datetimes with time zones to be worked with. This works around the
issue in superset by re-implementing the logic of pandas in the
correct way. Until pandas fixes the issue this code should stay.

https://github.com/pandas-dev/pandas/issues/18372

This closes #1929
2017-11-20 08:33:18 -08:00
John Bodley 3c72e1f8fb [3541] Augmenting datasources uniqueness constraints (#3583) 2017-11-19 20:09:18 -08:00
John Bodley ba89b2d091 [cache] Fixing cache key w/ merged extra filters (#3809) 2017-11-14 21:12:26 -08:00
John Bodley ac57780607 [flake8] Resolving Q??? errors (#3847) 2017-11-13 21:06:51 -08:00
John Bodley 1b4f128f55 [flake8] Resolving F5?? errors (#3846) 2017-11-12 11:09:22 -08:00
Jeff Niu 4d48d5d854 [Explore] Altered Slice Tag (#3668)
* Added altered tag to explore slice view and fixes #3616

* unit tests

* Moved getDiffs logic into AlteredSliceTag

* code style fixs
2017-11-10 21:33:31 -08:00
John Bodley ba96984048 [flake8] Resolving E3?? errors (#3814) 2017-11-10 17:52:34 -08:00
John Bodley 690de862e8 [flake8] Resolve E1?? errors (#3805) 2017-11-10 12:06:22 -08:00
John Bodley 1ea4521d0c [flake8] Resolving E7?? errors (#3816) 2017-11-09 20:23:59 -08:00
Hugh A. Miles II ae8b249dc2 Added /healthcheck endpoint for integrations with envoy (#3819)
* fixed mergeconflicts

* fixed mergeconflicts forreal this time

* added healthcheck test
2017-11-09 20:23:28 -08:00
John Bodley d03b74f754 [flake8] Resolving F4?? errors (#3811) 2017-11-08 20:34:33 -08:00
John Bodley ec21d5af21 [flake8] Resolving E2?? errors (#3812) 2017-11-08 20:34:23 -08:00
John Bodley 17623f71d4 [flake8] Resolving C??? errors (#3787) 2017-11-07 21:32:45 -08:00
John Bodley e822fb50d8 [flake8] Resolving W??? errors (#3784) 2017-11-07 20:25:10 -08:00