-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add separate endpoint to fetch function names for autocomplete #12840
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12840 +/- ##
===========================================
- Coverage 67.00% 50.78% -16.22%
===========================================
Files 1022 477 -545
Lines 50105 17211 -32894
Branches 5191 4444 -747
===========================================
- Hits 33572 8741 -24831
+ Misses 16402 8470 -7932
+ Partials 131 0 -131
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes sense to me.
one thing you should check is if these function names also show up in the adhoc metric creation popover or in the virtual dataset editor. these are 2 other places where i'd imagine the function names would be wanted for autocomplete
class ImportV1DatabaseExtraSchema(Schema): | ||
metadata_params = fields.Dict(keys=fields.Str(), values=fields.Raw()) | ||
engine_params = fields.Dict(keys=fields.Str(), values=fields.Raw()) | ||
metadata_cache_timeout = fields.Dict(keys=fields.Str(), values=fields.Integer()) | ||
schemas_allowed_for_csv_upload = fields.List(fields.String) | ||
schemas_allowed_for_csv_upload = fields.List(fields.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this change be here? Also how is fields.Str()
different from fields.String()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be String()
here. Str
is an alias of String
(see bottom of https://marshmallow.readthedocs.io/en/stable/_modules/marshmallow/fields.html).
* master: (23 commits) feat(explore): clear search on dataset change (apache#12909) chore: remove SIP-38 feature flag (apache#12894) fix: Config for dataset health check (apache#12906) fix(chart): allow null for most query object props (apache#12905) feat: add separate endpoint to fetch function names for autocomplete (apache#12840) chore: add required review on master (apache#12694) fix: comment typo (apache#12898) Migrates Radio component from Bootstrap to AntD. (apache#12738) fix: allow users to reset their passwords (apache#12886) fix(explore): missing select when groupby without metrics (apache#12890) refactor: dbapi exception mapping for dbapi's (apache#12869) feat(style-theme): add support for custom superset themes (apache#12858) chore(lint): fix pre-commit error (apache#12884) refactor(color-schemes): refactor setting of color schemes (apache#12857) feat(native-filters): Add defaultValue for Native filters modal (apache#12199) feat(release): add github token to changelog script (apache#12872) fix(menu): always show settings dropdown (apache#12877) Migrates Label component from Bootstrap to AntD. (apache#12774) [Helm] Automate datasource import (apache#10771) build: Skip loading example data from configs in CI (apache#12610) ...
SUMMARY
Currently some of the
/api/v1/database/
API responses include the list of functions supported by the DB. This is currently only implemented in Presto and Hive, and both implementations need to query the 3rd party DB in order to get that list. If the DB is down or overloaded, this might time out or take too long to complete, affecting users who are trying to see the list of databases or using SQL Lab.Ideally we want to separate API calls that need to talk to 3rd party DBs (like Hive or Presto), from the calls that talk only to the main Superset DB. This PR changes the database response to not include the list of function names. This has been moved to a separate endpoint that is called asynchronously wherever needed (AFAIK only for autocomplete in SQL Lab).
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
I changed
superset.db_engine_specs.base.BaseEngineSpec.get_function_names
to return some fake data. Loaded SQL Lab and verified that they show up in the autocomplete, both when loading an existing tab as well as when creating a new one.ADDITIONAL INFORMATION