-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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/user_slices and /superset/fave_slices to API v1 #22964
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22964 +/- ##
==========================================
+ Coverage 67.68% 67.69% +0.01%
==========================================
Files 1914 1914
Lines 73928 73954 +26
Branches 8021 8021
==========================================
+ Hits 50036 50062 +26
Misses 21849 21849
Partials 2043 2043
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 |
6a52aa5
to
425df90
Compare
425df90
to
17667df
Compare
slices = ChartDAO.user_slices(cast(int, self._user_id)) | ||
|
||
payload = [] | ||
for o in slices: |
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.
We have a tendency to use slc
rather than the more opaque o
to represent a slice. That said I’m not sure what o
actually represents given that is presented as o.Slice
.
return payload | ||
|
||
def validate(self) -> None: | ||
if not self._user_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.
I know we do this elsewhere but mutating state inside validate
seems wrong to me.
superset/charts/dao.py
Outdated
) | ||
.filter( # pylint: disable=comparison-with-callable | ||
or_( | ||
Slice.id.in_(owner_ids_query), |
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.
Any reason this isn’t a join as opposed to a subquery? I suspect the subquery likely fetches significantly more slices than the user favorited.
superset/charts/api.py
Outdated
@@ -914,3 +916,43 @@ def import_(self) -> Response: | |||
) | |||
command.run() | |||
return self.response(200, message="OK") | |||
|
|||
@expose("/user_slices/") | |||
@expose("/user_slices/<int:user_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.
could we just use api/v1/chart/?q=(filters:!((col:owners,opr:rel_m_m,value:<USER_ID>)),order_direction:desc,page:0,page_size:25)
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.
mm, would that return favorited slices too?
68f537d
to
72fb5bb
Compare
72fb5bb
to
4a027f2
Compare
…hore/migrate-user-fav-slices-to-api-v1
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.
LGTM!
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.
LGTM
SUMMARY
Continuing the effort on deprecating all /superset/ REST API endpoints
Deprecates
/superset/user_slices
for/api/v1/chart/user_slices/
Deprecates
/superset/fave_slices
for/api/v1/chart/user_slices/
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION