-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
[sql_json] allow not specifying client_id #5730
Conversation
We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed.
47cffab
to
862075f
Compare
Codecov Report
@@ Coverage Diff @@
## master #5730 +/- ##
=========================================
Coverage ? 63.38%
=========================================
Files ? 361
Lines ? 22998
Branches ? 2559
=========================================
Hits ? 14577
Misses ? 8406
Partials ? 15
Continue to review full report at Codecov.
|
superset/views/core.py
Outdated
@@ -2406,8 +2408,8 @@ def sql_json(self): | |||
status=QueryStatus.PENDING if async_ else QueryStatus.RUNNING, | |||
sql_editor_id=request.form.get('sql_editor_id'), | |||
tmp_table_name=tmp_table_name, | |||
user_id=int(g.user.get_id()), | |||
client_id=request.form.get('client_id'), | |||
user_id=int(g.user.get_id()) if g.user and g.user.get_id() else 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.
I know that right now admin
has user id 1, but in the future it could change to be 0 and it would break this code. I think it's better to be more explicit here an unravel the one liner:
client_id = request.form.get('client_id') or utils.shortid()
try:
user_id = int(g.user.get_id())
except Exception:
user_id = None
query = Query(
...
user_id=user_id,
client_id=client_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.
What I'm fixing here is that g.user.get_id()
returns None
when using the token auth mechanism on our fork. int(None) raises.
I can change this to g.user.get_id() is not 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.
With the try block, int(None)
would raise and user_id
would be set to 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.
I'm not even sure that the int casting is necessary here, let me check
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.
Turns out it isn't necessary as far as I understand.
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments (cherry picked from commit 5616d7b) (cherry picked from commit bb0c888)
* [sql_json] allow not specifying client_id We're opening the sql_json endpoint at Lyft to other apps leveraging Superset as a data-access layer that enforces authentication and our data access policy. Currently sql_json requires the client to pass a `client_id` parameter that uniquely identifies the query, that can then be used for polling when in async mode. This PR makes it such that you don't have to define a client_id anymore. It just gets generated when not passed. * adressing comments
We're opening the sql_json endpoint at Lyft to other apps leveraging
Superset as a data-access layer that enforces authentication and our data
access policy.
Currently sql_json requires the client to pass a
client_id
parameterthat uniquely identifies the query, that can then be used for polling
when in async mode. This PR makes it such that you don't have to define
a client_id anymore. It just gets generated when not passed.