-
Notifications
You must be signed in to change notification settings - Fork 41
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
DOCS-2899: Edit code samples from Data client QA #3457
Merged
sguequierre
merged 7 commits into
viamrobotics:main
from
sguequierre:DOCS-2899/data-client-qa
Sep 19, 2024
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3f4d351
edit code samples
sguequierre c7e5ec1
Merge branch 'main' into DOCS-2899/data-client-qa
sguequierre 3069a9d
Make edits from code review
sguequierre 6e04c8a
apply suggestions from code review
sguequierre 0992e4b
Merge branch 'main' into DOCS-2899/data-client-qa
sguequierre d6198b3
Fixup
sguequierre 8ba7210
Apply suggestions from code review
sguequierre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,8 @@ Create a new dataset. | |
|
||
```python {class="line-numbers linkable-line-numbers"} | ||
dataset_id = await data_client.create_dataset( | ||
name="<dataset-name>", | ||
organization_id="<your-org-id>" | ||
name="<DATASET-NAME>", | ||
organization_id="<YOUR-ORG-ID>" | ||
) | ||
print(dataset_id) | ||
``` | ||
|
@@ -38,7 +38,7 @@ Delete a dataset. | |
|
||
**Parameters:** | ||
|
||
- `id` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The ID of the dataset. | ||
- `id` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The ID of the dataset. You can retrieve this by navigating to the **DATASETS** sub-tab of the **DATA** tab, clicking on the dataset, clicking the **...** menu and selecting **Copy dataset ID**. | ||
|
||
**Returns:** | ||
|
||
|
@@ -48,7 +48,7 @@ Delete a dataset. | |
|
||
```python {class="line-numbers linkable-line-numbers"} | ||
await data_client.delete_dataset( | ||
id="abcd-1234xyz-8765z-123abc" | ||
id="<YOUR-DATASET-ID>" | ||
) | ||
``` | ||
|
||
|
@@ -77,8 +77,8 @@ Rename a dataset specified by the dataset ID. | |
|
||
```python {class="line-numbers linkable-line-numbers"} | ||
await data_client.rename_dataset( | ||
id="abcd-1234xyz-8765z-123abc", | ||
name="<dataset-name>" | ||
id="<YOUR-DATASET-ID>", | ||
name="MyDataset" | ||
) | ||
``` | ||
|
||
|
@@ -105,8 +105,8 @@ Get the datasets in an organization. | |
**Example:** | ||
|
||
```python {class="line-numbers linkable-line-numbers"} | ||
datasets = await data_client.list_dataset_by_organization_id( | ||
organization_id=[""a12b3c4e-1234-1abc-ab1c-ab1c2d345abc""] | ||
datasets = await data_client.list_datasets_by_organization_id( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch |
||
organization_id="<YOUR-ORG-ID>" | ||
) | ||
print(datasets) | ||
``` | ||
|
@@ -135,7 +135,7 @@ Get a list of datasets using their IDs. | |
|
||
```python {class="line-numbers linkable-line-numbers"} | ||
datasets = await data_client.list_dataset_by_ids( | ||
ids=["abcd-1234xyz-8765z-123abc"] | ||
ids=["<YOUR-DATASET-ID-1>, <YOUR-DATASET-ID-2>"] | ||
) | ||
print(datasets) | ||
``` | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 confused with this, this feels like it's become a much more involved code sample. And we now no longer show how it works with pymongo?
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 was required to make it work and I am still using pymongo-- it wasn't working for me otherwise
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 see you are indeed using
pymongo
. Which means the code now doesn't work for thebson
package.I just tested both code snippets again and they do work.
Did you run
pip uninstall pymongo
andpip install bson
when you were using the bson package code? Can you try these again and let me know if they work? If not lets look into it together. The code snippets as they are are a lot shorter and cleaner so if possible I'd like to stick with themMaybe we can make that clearer like 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.
I got the first option to work with organization_id. The second option as far as i can tell with pymongo still needs to be bson.BSON to work properly. Editing as such
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.
yeah true I missed the
organization_id
bit when copying - I'll send you a code snippet.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.
bson.BSON.encode
works, but weirdly so does running it without. I'd love to see what error you're getting but this is fine to merge