-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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(database): POST, PUT, DELETE API endpoints #10741
Conversation
show_columns = [ | ||
"id", | ||
"database_name", | ||
"cache_timeout", | ||
"expose_in_sqllab", | ||
"allow_run_async", | ||
"allow_csv_upload", | ||
"allow_ctas", | ||
"allow_cvas", | ||
"allow_dml", | ||
"force_ctas_schema", | ||
"allow_multi_schema_metadata_fetch", | ||
"impersonate_user", | ||
"encrypted_extra", | ||
"extra", | ||
"server_cert", | ||
"sqlalchemy_uri", | ||
] |
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 we add all these fields to list_columns
as well? Most of them are already included anyway, so it would save a GET request when opening the edit modal.
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.
I can do that, but I would prefer not to wire the whole detail payload for all the databases. Users will probably edit very few database connections, but will probably search, sort etc much more.
The cost for a get operation by a primary key is low also
from superset.extensions import security_manager | ||
from superset.models.core import Database | ||
from superset.typing import FlaskResponse | ||
from superset.utils.core import error_msg_from_exception | ||
from superset.views.base_api import BaseSupersetModelRestApi, statsd_metrics | ||
from superset.views.database.filters import DatabaseFilter | ||
from superset.views.database.validators import sqlalchemy_uri_validator |
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.
Moved this to superset/databases/utils.py
since they are utility/helper functions
database = DatabaseDAO.create(self._properties, commit=False) | ||
database.set_sqlalchemy_uri(database.sqlalchemy_uri) | ||
# adding a new database we always want to force refresh schema list | ||
# TODO Improve this simplistic implementation for catching DB conn fails |
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.
Note: Since we need to fetch db schemas to create schema permissions, we need valid/working connections when creating a database, made a simplistic approach to this, since this PR was already big.
@lilykuang we could move db test connection logic into a command
@@ -1,268 +0,0 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one |
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.
Let's remember to use git mv
to retain history.
Codecov Report
@@ Coverage Diff @@
## master #10741 +/- ##
==========================================
+ Coverage 58.92% 61.49% +2.56%
==========================================
Files 756 429 -327
Lines 36072 13954 -22118
Branches 3301 3555 +254
==========================================
- Hits 21256 8581 -12675
+ Misses 14633 5186 -9447
- Partials 183 187 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…boards_permissions * upstream/master: (32 commits) docs: Add a note to contributing.md on reporting security vulnerabilities (apache#10796) Fix: Include RLS filters for cache keys (apache#10805) feat: filters for database list view (apache#10772) fix: MVC show saved query (apache#10781) added creator column and adjusted order columns (apache#10789) security: disallow uuid package on jinja2 (apache#10794) feat: CRUD REST API for saved queries (apache#10777) fix: disable domain sharding on explore view (apache#10787) fix: can not type `0.05` in `TextControl` (apache#10778) fix: pivot table timestamp grouping (apache#10774) fix: add validator information to email/slack alerts (apache#10762) More Label touchups (margins) (apache#10722) fix: dashboard extra filters (apache#10692) fix: re-installing local superset in cache image (apache#10766) feat: SIP-34 table list view for databases (apache#10705) refactor: convert DatasetList schema filter to use new distinct api (apache#10746) chore: removing fsevents dependency (apache#10751) Fix precommit hook for docs/installation.rst (apache#10759) feat(database): POST, PUT, DELETE API endpoints (apache#10741) docs: Update OAuth configuration in installation.rst (apache#10748) ...
* feat(database): POST, PUT, DELETE API endpoints * post tests * more tests * lint * lint * debug ci * fix test * fix test * fix test * fix test * fix test * fix test * cleanup * handle db connection failures * lint * skip hive and presto for connection fail test * fix typo
SUMMARY
Creates REST API endpoints for Database POST, PUT and DELETE
ADDITIONAL INFORMATION