-
Notifications
You must be signed in to change notification settings - Fork 68
[AL-5278] [AL-5279] [AL-5260] Add catalog slice, data row, dataset support #1010
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
Conversation
7abc5c9
to
f6c071b
Compare
0773af8
to
4cfaf25
Compare
""" | ||
query_str = """ | ||
query getSavedQueryPyApi($id: ID!) { | ||
query_str = """query getSavedQueryPyApi($id: 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.
We have schema checker that expects the query to be in the first line
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.
The code changes look good to me, works fine locally 👍
Would be great to refactor it, but no-blocker
labelbox/schema/data_row.py
Outdated
print('export execution') | ||
print(client) |
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 cleanup this prints and leverage logger.*
where needed? Eg. logger.debug
or logger.info
res = res[mutation_name] | ||
task_id = res["taskId"] | ||
user: User = self.client.get_user() | ||
tasks: List[Task] = list( | ||
user.created_tasks(where=Entity.Task.uid == task_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.
A minor suggestion: these 3 export_v2
methods could be moved to a separate dedicated service like ExportService
. This service could have 3 methods: export_dataset
, export_data_row
and export_slice
. And then these methods could be called in the corresponding classes (Dataset, DataRow and Slice).
This way you would be able to reuse the code parts that are currently duplicated in Dataset.export_v2
, DataRow.export_v2
and Slice.export_v2
: fetching the task object or building and calling exportDataRowsInCatalog
(though it's duplicated only in DataRows and Dataset classes).
Besides reducing code duplication it would increase coherence of the code in ExportService
. Also Dataset
class will get to 723 lines long size with this change, putting the most of logic into ExportService
would avoid inflating the modules' sizes
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.
That was my thought as well — will refactor this as part of SDK v4 initiative that aims to use REST endpoints for SDK instead (we'll need backend changes to facilitate this).
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
AL-5278
AL-5279
AL-5280
Edit: Added test cases for all the methods, no need to run the below
Need to prepare staging acc to add tests, right now can be tested by checking out to the branch and: