graviti.manager.search#

The implementation of the SearchHistory and SearchManager.

Module Contents#

Classes#

SearchHistory

This class defines the structure of the search history of Graviti Data Platform.

SearchManager

This class defines the operations on the searches on Graviti.

class graviti.manager.search.SearchHistory(dataset, response)[source]#

Bases: graviti.utility.ReprMixin

This class defines the structure of the search history of Graviti Data Platform.

Parameters
  • dataset (graviti.manager.dataset.Dataset) – Class Dataset instance.

  • response (Dict[str, Any]) –

    The response of the OpenAPI associated with the search history:

    {
        "id": <str>
        "commit_id": <str>,
        "draft_number": <int>,
        "sheet": <str>,
        "criteria": <dict>,
        "record_count": <int>,
        "creator": <str>,
        "created_at": <str>,
    },
    

search_id#

The id of this search history.

commit#

The commit of this search history.

draft_number#

The draft number of this search history.

sheet#

The sheet name of this search history.

criteria#

The criteria of this search history.

creator#

The creator of this search history.

created_at#

The create time of this search history.

record_count(self)[source]#

Get the record count of the search.

Returns

The record count of the search.

Return type

int

schema(self)[source]#

Get the schema of the search result.

Returns

The schema of the search result.

Return type

graviti.portex.record

run(self)[source]#

Run the search and get the result DataFrame.

Returns

The search result DataFrame.

Return type

graviti.dataframe.DataFrame

class graviti.manager.search.SearchManager(dataset)[source]#

This class defines the operations on the searches on Graviti.

Parameters
get(self, search_id)[source]#

Get a Graviti search history with given search id.

Parameters

search_id (str) – The id of the search history.

Returns

The requested SearchManager instance.

Return type

SearchHistory

list(self, *, commit_id=None, draft_number=None, sheet=None, sort=None)[source]#

List Graviti search histories.

Parameters
  • 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.

Returns

The LazyPagingList of SearchHistory instances.

Return type

graviti.manager.lazy.LazyPagingList[SearchHistory]

delete(self, search_id)[source]#

Delete a Graviti search history with given search id.

Parameters

search_id (str) – The id of the search history.

Return type

None