Skip to content
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

Merged
merged 2 commits into from
Sep 6, 2018

Conversation

mistercrunch
Copy link
Member

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.

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.
@codecov-io
Copy link

codecov-io commented Aug 26, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@cae0704). Click here to learn what that means.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #5730   +/-   ##
=========================================
  Coverage          ?   63.38%           
=========================================
  Files             ?      361           
  Lines             ?    22998           
  Branches          ?     2559           
=========================================
  Hits              ?    14577           
  Misses            ?     8406           
  Partials          ?       15
Impacted Files Coverage Δ
superset/views/core.py 73.95% <100%> (ø)
superset/utils.py 88.98% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cae0704...862075f. Read the comment docs.

@@ -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,
Copy link
Member

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,
)

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member Author

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.

@mistercrunch mistercrunch merged commit 5616d7b into apache:master Sep 6, 2018
@mistercrunch mistercrunch deleted the autoshortid branch September 6, 2018 05:34
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
* [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
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
* [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)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* [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)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* [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)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* [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)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* [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)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* [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)
mistercrunch added a commit to lyft/incubator-superset that referenced this pull request Oct 29, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* [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)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* [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)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
* [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)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
* [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)
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* [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
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants