graviti.openapi.search
#
Interfaces about the search.
Module Contents#
Functions#
|
Execute the OpenAPI POST /v2/datasets/{workspace}/{dataset}/searches. |
|
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches. |
|
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches/{search_id}. |
|
Execute the OpenAPI DELETE /v2/datasets/{workspace}/{dataset}/searches/{search_id}. |
|
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches/{search_id} /record-count. |
|
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches/{search_id}/records. |
- graviti.openapi.search.create_search_history(access_key, url, workspace, dataset, *, commit_id=None, draft_number=None, sheet, criteria)[source]#
Execute the OpenAPI POST /v2/datasets/{workspace}/{dataset}/searches.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The name of the workspace.
dataset (str) – The name of the dataset.
commit_id (Optional[str]) – The commit id.
draft_number (Optional[int]) – The draft number.
sheet (str) – The name of the sheet.
criteria (Dict[str, Any]) – The criteria of the search.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> create_search_history( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "portex-test", ... "BDD100K", ... commit_id="89c33716f3834e188ac1ff749c6c270d", ... sheet="train", ... criteria={"where": {"$any_match": ["$.box2ds", {"$eq": ["$.category", 7]}]}}, ... ) { "id": "53dbbedf35064f21a7b85def60de840e", "commit_id": "89c33716f3834e188ac1ff749c6c270d", "sheet": "train", "criteria": { "where": { "$any_match": ["$.box2ds", { "$eq": ["$.category", 7] }] } }, "creator": "linjiX", "created_at": "2021-03-05T18:58:10Z", "record_count": null }
- graviti.openapi.search.list_search_histories(access_key, url, workspace, dataset, *, commit_id=None, draft_number=None, sheet=None, sort=None, offset=None, limit=None)[source]#
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The name of the workspace.
dataset (str) – The name of the dataset.
commit_id (Optional[str]) – The commit id.
draft_number (Optional[int]) – The draft number.
sheet (Optional[str]) – The name of the sheet.
sort (graviti.utility.SortParam) – The column and the direction the list result sorted by.
offset (Optional[int]) – The offset of the page. The default value of this param in OpenAPIv2 is 0.
limit (Optional[int]) – The limit of the page. The default value of this param in OpenAPIv2 is 128.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> list_search_histories( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "portex-test", ... "BDD100K", ... ) { "searches": [ { "id": "a97a31b29c154b82b3049b7f46904b69", "draft_number": 2, "sheet": "test", "criteria": { "where": { "$any_match": ["$.box2ds", { "$eq": ["$.category", 7] }] } }, "creator": "linjiX", "created_at": "2021-03-06T18:58:10Z", "record_count": 200 }, { "id": "53dbbedf35064f21a7b85def60de840e", "commit_id": "89c33716f3834e188ac1ff749c6c270d", "sheet": "train", "criteria": { "where": { "$any_match": ["$.box2ds", { "$eq": ["$.category", 7] }] } }, "creator": "linjiX", "created_at": "2021-03-05T18:58:10Z", "record_count": 1000 } ], "offset": 0, "record_size": 2, "total_count": 2 }
- graviti.openapi.search.get_search_history(access_key, url, workspace, dataset, *, search_id)[source]#
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches/{search_id}.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The name of the workspace.
dataset (str) – The name of the dataset.
search_id (str) – The search id.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> get_search_history( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "portex-test", ... "BDD100K", ... search_id="53dbbedf35064f21a7b85def60de840e", ... ) { "id": "53dbbedf35064f21a7b85def60de840e", "commit_id": "89c33716f3834e188ac1ff749c6c270d", "sheet": "train", "criteria": { "where": { "$any_match": ["$.box2ds", { "$eq": ["$.category", 7] }] } }, "creator": "linjiX", "created_at": "2021-03-05T18:58:10Z", "record_count": 1000 }
- graviti.openapi.search.delete_search_history(access_key, url, workspace, dataset, *, search_id)[source]#
Execute the OpenAPI DELETE /v2/datasets/{workspace}/{dataset}/searches/{search_id}.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The name of the workspace.
dataset (str) – The name of the dataset.
search_id (str) – The search id.
- Return type
None
Examples
>>> delete_search_history( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "portex-test", ... "BDD100K", ... search_id="53dbbedf35064f21a7b85def60de840e", ... )
- graviti.openapi.search.get_search_record_count(access_key, url, workspace, dataset, *, search_id)[source]#
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches/{search_id} /record-count.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The name of the workspace.
dataset (str) – The name of the dataset.
search_id (str) – The search id.
- Returns
The response of OpenAPI.
- Return type
int
Examples
>>> get_search_record_count( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "portex-test", ... "BDD100K", ... search_id="53dbbedf35064f21a7b85def60de840e", ... ) 1000
- graviti.openapi.search.list_search_records(access_key, url, workspace, dataset, *, search_id, sort=None, offset=None, limit=None)[source]#
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/searches/{search_id}/records.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The name of the workspace.
dataset (str) – The name of the dataset.
search_id (str) – The search id.
sort (graviti.utility.SortParam) – The column and the direction the list result sorted by.
offset (Optional[int]) – The offset of the page. The default value of this param in OpenAPIv2 is 0.
limit (Optional[int]) – The limit of the page. The default value of this param in OpenAPIv2 is 128.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> list_search_records( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "portex-test", ... "BDD100K", ... search_id="53dbbedf35064f21a7b85def60de840e", ... ) { "records": [ { "__record_key": "2312312312321", "filename": "0000f77c-6257be58.jpg", "image": { "key": "dcc197970e607f7576d978972f6fb312911ce005", "extension": ".jpg", "size": 52344, "width": 800, "heithg": 600 }, "attribute": { "weather": "clear", "scene": "city street", "timeofday": "daytime" } }, ...(total 5 items) ] }