-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
chore: Migrate /superset/estimate_query_cost/<database_id>/<schema>/ to API v1 #22910
Conversation
7c4cceb
to
99ce414
Compare
492488c
to
ee7d1d3
Compare
…stimate_query_cost-to-v1
ee7d1d3
to
a4ec247
Compare
Codecov Report
@@ Coverage Diff @@
## master #22910 +/- ##
===========================================
- Coverage 67.45% 56.21% -11.25%
===========================================
Files 1878 1878
Lines 72140 72218 +78
Branches 7866 7872 +6
===========================================
- Hits 48663 40595 -8068
- Misses 21458 29603 +8145
- Partials 2019 2020 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
self._schema = params.get("schema", "") | ||
|
||
def validate(self) -> None: | ||
self._database = db.session.query(Database).get(self._database_id) |
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 should go to the DAO to get all possible security constraints applied to it
ExecutePayloadSchema, | ||
QueryExecutionResponseSchema, | ||
) | ||
|
||
@expose("/estimate/", methods=["POST"]) |
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.
What do you think about placing this one on /api/v1/database/
instead?
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's a balancing act here, I agree.
I think the database resource is bloated already, and while I could see usages outside SQL lab, we don't at the moment nor in the medium term (afaik).
I could see arguments on both sides and I don't feel particularly strong about either of them
_schema: str | ||
_database: Database | ||
|
||
def __init__(self, params: EstimateQueryCostSchema) -> None: |
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.
user should be passed in, because there are some security constraints that should be applied
superset/sqllab/schemas.py
Outdated
@@ -25,6 +25,13 @@ | |||
} | |||
|
|||
|
|||
class EstimateQueryCostSchema(Schema): | |||
database_id = fields.Integer(required=True) | |||
sql = fields.String(required=True) |
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 add some nice descriptions here
sqllab_timeout=app.config["SQLLAB_QUERY_COST_ESTIMATE_TIMEOUT"], | ||
) | ||
|
||
def test_run_success(self) -> None: |
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.
add some tests for users that don't have access to the database (missing database access on [some-db.id])
…stimate_query_cost-to-v1
8e262dd
to
7ab30e8
Compare
7ab30e8
to
c660773
Compare
@dpgaspar the remaining comments here I believe will be addressed by you as a follow up right? |
SUMMARY
Continuing the effort on deprecating all /superset/ REST API endpoints
Deprecates
/superset/estimate_query_cost
for/api/v1/sqllab/estimate/
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION