Base Model and Manager#
- class patent_client.util.manager.Manager(config=None)[source]#
Manager Class
This class is essentially a configurable generator. It is intended to be initialized as an empty object at Model.objects. Users can then call methods to modify the manager. All methods should return a brand-new manager with the appropriate parameters re-set. The manager’s attributes are stored in a dictionary at Manager.config.
- offset(offset) Self [source]#
Specify the number of records from the beginning from which to apply an offset
- async aget(*args, **kwargs) ModelType [source]#
If the critera results in a single record, return it, else raise an exception
- async ato_pandas(annotate=[]) pandas.DataFrame #
Convert Collection into a Pandas DataFrame
- explode(attribute, unpack=False, connector='.', prefix=True) Union[UnpackedCollection, ExplodedCollection] #
Implement an “explode” function for nested listed objects.
- to_pandas(annotate=[]) pandas.DataFrame #
Convert Collection into a Pandas DataFrame
- to_records(item_class=<class 'dict'>, collection_class=<class 'list'>) List[dict] #
Return a list of dictionaries containing item data in ordinary Python types Useful for ingesting into NoSQL databases
- unpack(attribute, connector='.', prefix=True) UnpackedCollection #
Implement an “unpack” function for nested single objects
- values(*fields, **kw_fields) ValuesCollection #
Return a Collection that will return a Row object for each item with a subset of attributes positional arguments will result in Row objects where the fields match the field names on the item, keyword arguments can be used to rename attributes. When passed as key=field, the resulting dictionary will have key: item[field]
- values_list(*fields, flat=False, **kw_fields) ValuesListCollection #
Return a Collection that will return tuples for each item with a subset of attributes. If only a single field is passed, the keyword argument “flat” can be passed to return a simple list