Commit Graph

1293 Commits

Author SHA1 Message Date
Sujith Kumar S b8aef10098
fix(mssql): support cte in virtual tables (#18567)
* Fix for handling regular CTE queries with MSSQL,#8074

* Moved the get_cte_query function from mssql.py to base.py for using irrespetcive of dbengine

* Fix for handling regular CTE queries with MSSQL,#8074

* Moved the get_cte_query function from mssql.py to base.py for using irrespetcive of dbengine

* Unit test added for the db engine CTE SQL parsing.

Unit test added for the db engine CTE SQL parsing.  Removed additional spaces from the CTE parsing SQL generation.

* implement in sqla model

* lint + cleanup

Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
2022-02-10 10:28:05 +02:00
Victor Arbues 5ee070c402
feat: datasource access to allow more granular access to tables on SQL Lab (#18064) 2022-02-09 22:05:25 +08:00
Ville Brofeldt fdbcbb5c84
fix(csv-export): pivot v2 with verbose names (#18633)
* fix(csv-export): pivot v2 with verbose names

* refine logic + add test

* add missing verbose_map
2022-02-09 14:01:57 +02:00
Hugh A. Miles II 7194a01040
fix: user UUIDs on export for Native Filter Configuration (#18562)
* saving work for import

* update

* move logic to update ref

* remove export updates

* remove unneeded code

* cleanup

* Update superset/dashboards/commands/importers/v1/utils.py

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>

* Update tests/unit_tests/dashboards/commands/importers/v1/utils_test.py

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
2022-02-08 13:10:40 -08:00
Ville Brofeldt 125be78ee6
feat(chart-data-api): download multiple csvs as zip (#18618)
* feat(chart-data-api): download multiple csvs as zip

* break out util

* check for empty request
2022-02-08 14:25:06 -05:00
ofekisr 41f3c95345
feat: log decorator util - adding automatic logs out of the box (#18620)
* feat: add logger utils

* fix bad definitions of under_info and debug_enable

* fix pre-commit
2022-02-08 18:38:57 +02:00
Ville Brofeldt 55cd7fb412
fix(sqla): avoid unnecessary groupby for when no metrics (#18579) 2022-02-04 10:47:47 +02:00
Ville Brofeldt 7ad38d5ba1
chore(tests): migrate mssql tests to pytest (#18251)
* move test

* migrate to pytest
2022-02-02 13:19:58 +02:00
Dave McNulla 8c376548e3
fix(teradata): LIMIT syntax (#18240)
Co-authored-by: Mccush, Jack <jack.mccush@teradata.com>
Co-authored-by: Jack McCush <33156805+mccushjack@users.noreply.github.com>
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
Co-authored-by: David McNulla <david.mcnulla@teradata.com>
2022-01-31 19:15:42 -08:00
Adam Dobrawy dad6f78419
refactor: extract json_required view decorator (#18170)
* refactor: extract json_required view decorator

* chore: rename json_required to requires_json

* refactor: add requires_form_data decorator and use it

* fix: fix lint issue, raise InvalidPayloadFormatError for invalid payload
2022-01-31 08:53:48 -03:00
Stephen Liu 9671384efe
fix(sql): unable to filter text with quotes (#17881) 2022-01-28 21:49:22 +08:00
Adam Dobrawy 84db896797
Remove walrus operator for Python 3.7 compatiblity (#18205) 2022-01-28 10:03:22 +02:00
cccs-joel 8b83c7fe0a
fix: Assign an owner when creating a dataset from a csv, excel or tabular (#17986)
* Assign an owner when creating a dataset from a csv, excel or columnar

* Added some unit tests

* Code cleanup

* Removed blank line

* Attempt to fix a broken test

* Attempt # 2 to fix a broken test

* Attempt # 3 to fix a broken test

* Attempt # 4 to fix a broken test

* Attempt # 5 to fix a broken test

* Attempt # 6 to fix a broken test

* Broken test fixed, code cleanup
2022-01-27 17:55:20 +02:00
Yongjie Zhao 20b4ae1ef9
fix: null value and empty string in filter (#18171) 2022-01-27 22:58:06 +08:00
AAfghahi fa11a97585
fix: remove standalone (#18157)
* removed standalone

* Update tests/integration_tests/reports/commands_tests.py

* changed standalone

* added tests

* made function more generic

* Update superset/reports/notifications/email.py

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
2022-01-26 13:04:26 -05:00
David Aaron Suddjian 4ad5ad045a
feat: embedded dashboard core (#17530)
* feat(dashboard): embedded dashboard UI configuration (#17175) (#17450)

* setup embedded provider

* update ui configuration

* fix test

* feat: Guest token (for embedded dashboard auth) (#17517)

* generate an embed token

* improve existing tests

* add some auth setup, and rename token

* fix the stuff for compatibility with external request loaders

* docs, standard jwt claims, tweaks

* black

* lint

* tests, and safer token decoding

* linting

* type annotation

* prettier

* add feature flag

* quiet pylint

* apparently typing is a problem again

* Make guest role name configurable

* fake being a non-anonymous user

* just one log entry

* customizable algo

* lint

* lint again

* 403 works now!

* get guest token from header instead of cookie

* Revert "403 works now!"

This reverts commit df2f49a6d4.

* fix tests

* Revert "Revert "403 works now!""

This reverts commit 883dff38f1.

* rename method

* correct import

* feat: entry for embedded dashboard (#17529)

* create entry for embedded dashboard in webpack

* add cookies

* lint

* token message handshake

* guestTokenHeaderName

* use setupClient instead of calling configure

* rename the webpack chunk

* simplified handshake

* embedded entrypoint: render a proper app

* make the embedded page accept anonymous connections

* format

* lint

* fix test
# Conflicts:
#	superset-frontend/src/embedded/index.tsx
#	superset/views/core.py

* lint

* Update superset-frontend/src/embedded/index.tsx

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>

* comment out origins checks

* move embedded for core to dashboard

* pylint

* isort

Co-authored-by: David Aaron Suddjian <aasuddjian@gmail.com>
Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>

* feat: Authorizing guest access to embedded dashboards (#17757)

* helper methods and dashboard access

* guest token dashboard authz

* adjust csrf exempt list

* eums don't work that way

* Remove unnecessary import

* move row level security tests to their own file

* a bit of refactoring

* add guest token security tests

* refactor tests

* clean imports

* variable names can be too long apparently

* missing argument to get_user_roles

* don't redefine builtins

* remove unused imports

* fix test import

* default to global user when getting roles

* missing import

* mock it

* test get_user_roles

* infer g.user for ease of tests

* remove redundant check

* tests for guest user security manager fns

* use algo to get rid of warning messages

* tweaking access checks

* fix guest token security tests

* missing imports

* more tests

* more testing and also some small refactoring

* move validation out of parsing

* fix dashboard access check again

* add more test

Co-authored-by: Lily Kuang <lily@preset.io>

* feat: Row Level Security rules for guest tokens (#17836)

* helper methods and dashboard access

* guest token dashboard authz

* adjust csrf exempt list

* eums don't work that way

* Remove unnecessary import

* move row level security tests to their own file

* a bit of refactoring

* add guest token security tests

* refactor tests

* clean imports

* variable names can be too long apparently

* missing argument to get_user_roles

* don't redefine builtins

* remove unused imports

* fix test import

* default to global user when getting roles

* missing import

* mock it

* test get_user_roles

* infer g.user for ease of tests

* remove redundant check

* tests for guest user security manager fns

* use algo to get rid of warning messages

* tweaking access checks

* fix guest token security tests

* missing imports

* more tests

* more testing and also some small refactoring

* move validation out of parsing

* fix dashboard access check again

* rls rules for guest tokens

* test guest token rls rules

* more flexible rls rules

* lint

* fix tests

* fix test

* defaults

* fix some tests

* fix some tests

* lint

Co-authored-by: Lily Kuang <lily@preset.io>

* SupersetClient guest token test

* Apply suggestions from code review

Co-authored-by: Lily Kuang <lily@preset.io>

Co-authored-by: Lily Kuang <lily@preset.io>
2022-01-25 16:41:32 -08:00
cccs-Dustin 2dd64f9a93
fix(import_datasources): --sync flag works correctly (#18046)
* Added code that properly accepts the -s flag on the import-datasources cli command. Also added unit tests for all of the edge cases (with both metrics & columns, with just columns, and with just metrics)

* Files were reformated using the 'pre-commit run --all-files' command

* added '*args: Any' back into v0.py as it did not need to be removed. Removing it might cause headaches for someone trying to work on this particular piece of code in the future

* Fixed the merge conflict as the cli.py was moved to another directory

* Modified my created unit tests to work with the new format of uni tests since the merge

* Modified my created unit tests to work with the new format of uni tests since the merge

* Fixed errors which were encountered while using the unit tests
2022-01-25 15:53:44 +01:00
Michael S. Molina f018c826b8
refactor: Moves the Explore form_data endpoint (#18151)
* refactor: Moves the Explore form_data endpoint

* Removes unused imports

* Fixes openapi schema error

* Fixes typo

* Renames and UPDATING.md
2022-01-25 11:14:50 -03:00
Michael S. Molina 959b15eeca
feat: Adds a key-value endpoint to store charts form data (#17882)
* feat: Adds a key-value endpoint to store charts form data

* Fixes linting problems

* Removes the query_params from the endpoints

* Refactors the commands

* Removes unused imports

* Changes the parameters to use dataclass

* Adds more access tests

* Gets the first dataset while testing

* Adds unit tests for the check_access function

* Changes the can_access check

* Always check for dataset access
2022-01-20 16:27:57 -03:00
Beto Dealmeida 9e2bc72fb9
chore: split CLI into multiple files (#18082)
* chore: split CLI into multiple files

* Update tests

* Who fixes the fixtures?

* Add subcommands dynamically

* Rebase
2022-01-19 11:27:16 -08:00
ofekisr 810cfc13db
fix can't use examples helpers on non app context based environment (#18086) 2022-01-19 20:16:15 +02:00
ofekisr 4675ca31c5
refactor(example_data): replace the way the birth_names data is loaded to DB (#18060)
* refactor: replace the way the birth_names data is loaded to DB

* fix failed unit test

* fix failed unit test

* fix failed tests

* fix pass wrong flag of support datetime type

* remove unused fixture
2022-01-18 23:21:04 +02:00
Yongjie Zhao 0c7f7288d8
feat(advanced analytics): support groupby in resample (#18045) 2022-01-17 18:42:59 +08:00
ofekisr e53a50a155
chore(supeset.utils.core): move all database utils to database utils module (#18058) 2022-01-16 08:32:50 +02:00
Đặng Minh Dũng 0b67fe1beb
feat: Trino Authentications (#17593)
* feat: support Trino Authentications

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* docs: Trino Authentications

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
2022-01-14 21:02:47 -08:00
Erik Ritter 14b9298ef7
fix: revert #17654 to fix subselect table name parsing (#18017) 2022-01-12 21:28:23 -08:00
Beto Dealmeida 51090c3f1b
feat: shorter timeout on test_connection (#18001)
* feat: shorter timeout on test_connection

* pip-compile-multi --no-upgrade

* Fix for SQLite

* Return 408

* Add test
2022-01-12 13:01:34 -08:00
John Bodley 63ca09e345
fix: Workaround for sqlparse issue #652 (#17995)
* fix: Workaround for sqlparse issue #652

* Update superset/sql_parse.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* Update sql_parse.py

Co-authored-by: John Bodley <john.bodley@airbnb.com>
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
2022-01-12 14:03:56 +13:00
Ajay M bdc35a2214
feat(alerts): Select tabs to send backend (#17749)
* Adding the extra config and validation

* wip

* reports working

* Tests working

* fix type

* Fix lint errors

* Fixing type issues

* add licence header

* fix the fixture deleting problem

* scope to session

* fix integration test

* fix review comments

* fix review comments patch 2

Co-authored-by: Grace Guo <grace.guo@airbnb.com>
2022-01-11 10:48:50 -08:00
ofekisr 7fc6a2f36c
refactor: examples data loading for tests (#17893)
* refactor: replace the way the birth_names data is generated

* refactor: replace the way the birth_names data is generated

* refactor structure
add tests for common
2022-01-11 14:16:09 +02:00
Michael S. Molina 3a9bd12e3d
fix: Returns 404 instead of 500 for unknown dashboard filter state keys (#17878)
* fix: Returns 404 instead of 500 for unknown dashboard filter state keys

* Reduces hierarchies of if-expression

* Removes unnecessary check

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* Removes unused variable

* Fixes type error

* Removes unused import

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
2022-01-10 14:24:22 -03:00
Daniel Vaz Gaspar d35da1fc73
fix: css template API response, less data (#17980)
* fix: css template API response, less data

* add test
2022-01-10 13:00:39 +00:00
Mikhail Kumachev d2d4f8eb44
feat: Add support for Azure Data Explorer (Kusto) db engine spec (#17898)
* Add two Kusto engine specs: KQL and SQL. Some minor changes in core code to support Kusto engine specs.

* Remove redundant imports and logging.

* docs: Kusto sqlalchemy docs

* fix: Fix mypy and linting errors

* fix: Handle Black vs Pylint checks

* fix: isort problem

* refactor: Merge kustosql and kustokql in the single kusto module

* test: Add tests for Kusto db spec

* feat: Schema override does not require in KQL anymore

* Removed redundant imports.

* Added ".show" queries to readonly query determination.

* Fixed some bugs.
Added tests for convert_dttm.

* Fixed major sqlalchemy-kusto version.

* Fixed by isort.

Co-authored-by: Eugene Bikkinin <xnegxneg@gmail.com>
Co-authored-by: k.tomak <k.tomak@dodopizza.com>
Co-authored-by: Eugene Bikkinin <e.bikkinin@dodopizza.com>
2022-01-10 14:42:20 +02:00
Amit Miran 4954d52329
ci: make presto hive tests to cover only chartData and sqljson (#17782)
* chore: make presto hive tests to cover only chartData and sqljson

* fix: single quote

* fix: add eval for arguments

* fix: add double quotes on args

* chore: add @pytest.mark.sql_json_flow

* fix: pre-commit
2021-12-31 07:17:54 +02:00
Michael S. Molina 8ebec6016e
fix: Removes duplicated import in dashboard filter state tests (#17887) 2021-12-29 13:10:56 -03:00
ofekisr 886e4ef7f5
fix: tests can failed on different order executions (#17885) 2021-12-29 17:54:12 +02:00
Beto Dealmeida 2cd8054358
feat: add force option to report screenshots (#17853)
* Update existing tests

* Add backend test

* feat: add force option to report screenshots

* Add tests

* Rebase fixes

* Do not force screenshot on dashboard alerts
2021-12-22 12:16:04 -08:00
Beto Dealmeida 30c0459808
fix: extra column in metrics (#17784) 2021-12-22 10:39:29 -08:00
Beto Dealmeida c49545aec1
fix: dataset extra import/export (#17740)
* fix: dataset extra import/export

* Update superset/datasets/commands/importers/v1/utils.py
2021-12-22 09:41:31 -08:00
Beto Dealmeida b7707e8ff7
feat: bypass cache on screenshots for alerts (#17695)
* feat: bypass cache on screenshots for alerts

* Update existing tests

* Add backend test

* Add frontend test
2021-12-22 08:26:38 -08:00
Elizabeth Thompson b82da5c016
accept null params for validation (#17788) 2021-12-17 10:52:00 -08:00
Grace Guo c5af7a48df
fix: [alert] allow decimal for alert threshold value (#17751)
* fix: [alert] add tooltip message for alert threshold value

* support decimal value for alert condition threshold

* add integration test
2021-12-16 22:51:23 -08:00
Bogdan afd2e9f2ca
chore: update fixtures scope that are loading data into the analytical db (#17780)
* Update db setup fixture scope

* Load data into db only once

* Update fixture scopes for data loading

* cleanup imports

* try import

* Update scope

* fix cleanup

* Import all fixtures

* Separate data log and metadata creation

* Retain table description

* fix dtype

Co-authored-by: Bogdan Kyryliuk <bogdankyryliuk@dropbox.com>
2021-12-16 16:11:47 -08:00
Grace Guo a01c4c95db
fix: [alert] should run alert query from report account (#17499)
* fix: [alert] should run alert query from report account

* add solution2: override username for get_df

* add integration test
2021-12-16 12:12:43 +00:00
Beto Dealmeida c18d4862c4
chore: skip flaky test (#17772) 2021-12-15 17:06:40 -08:00
Evan Rusackas 3aa11614b5
fix: change 401 response to a 403 for Security Exceptions (#17768)
* fix: change 401 to 403 for Security Exceptions

* updating tests to reflect new (proper) status code

* another test update
2021-12-15 17:11:04 -07:00
Beto Dealmeida 37cc2c4d15
fix: column extra in import/export (#17738) 2021-12-14 18:33:52 -08:00
Beto Dealmeida 2633bcccc3
fix: import dashboard stale filter_scopes (#17741) 2021-12-14 07:23:55 -08:00
Beto Dealmeida fceabf6bc5
fix: import dash with missing immune ID (#17732) 2021-12-13 16:20:55 -08:00
Beto Dealmeida 0d2299cb60
fix: migration out-of-scope bind (#17728)
* fix: migration out-of-scope bind

* Bypass flaky test
2021-12-13 13:04:35 -08:00