Querying a Dataset List
Obtain a dataset list by page.
list_datasets(session, dataset_type=None, dataset_name=None, offset=None, limit=None)
Sample Code
- Example 1: Obtain a dataset list.
from modelarts.session import Session from modelarts.dataset import Dataset session = Session() # Obtain a dataset list. dataset_list = Dataset.list_datasets(session) print(dataset_list) # Print the query result.
- Example 2: Obtain a dataset list by dataset type.
# Obtain image classification datasets. dataset_list = Dataset.list_datasets(session, dataset_type=0) print(dataset_list)
- Example 3: Obtain a dataset list by dataset name.
# Obtain the datasets with dataset contained in dataset names. dataset_list = Dataset.list_datasets(session, dataset_name="dataset") print(dataset_list)
- Example 4: Obtain a dataset list by page.
# By default, 10 dataset records are returned at a time. You can set limit and offset for query by page. dataset_list = Dataset.list_datasets(session, offset=0, limit=50) # Obtain the 1st to 50th records. print(dataset_list) dataset_list = Dataset.list_datasets(session, offset=1, limit=50) # Obtain the 51st to 100th records. print(dataset_list)
Parameters
Name |
Mandatory |
Type |
Description |
---|---|---|---|
session |
Yes |
Object |
Session object. For details about the initialization method, see Session Authentication. |
dataset_type |
No |
Integer |
Obtain a dataset list by dataset type. By default, this parameter is left blank. The options are as follows:
|
dataset_name |
No |
String |
Fuzzy search keyword. By default, this parameter is left blank. |
offset |
No |
Integer |
Start page for pagination display. The default value is 0. |
limit |
No |
Integer |
Maximum number of records returned on each page. The value ranges from 1 to 100. The default value is 10. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.