Skip to main content

BaseDatasetClient

Abstract base class for dataset resource clients.

These clients are specific to the type of resource they manage and operate under a designated storage client, like a memory storage client.

Hierarchy

Index

Methods

delete

  • async delete(): None
  • Permanently delete the dataset managed by this client.


    Returns None

get

  • Get metadata about the dataset being managed by this client.


    Returns DatasetMetadata | None

get_items_as_bytes

  • async get_items_as_bytes(*, item_format, offset, limit, desc, clean, bom, delimiter, fields, omit, unwind, skip_empty, skip_header_row, skip_hidden, xml_root, xml_row, flatten): bytes
  • Retrieves dataset items as bytes.


    Parameters

    • optionalkeyword-onlyitem_format: str = 'json'

      Output format (e.g., 'json', 'csv'); default is 'json'.

    • optionalkeyword-onlyoffset: int | None = None

      Number of items to skip; default is 0.

    • optionalkeyword-onlylimit: int | None = None

      Max number of items to return; no default limit.

    • optionalkeyword-onlydesc: bool = False

      If True, results are returned in descending order.

    • optionalkeyword-onlyclean: bool = False

      If True, filters out empty items and hidden fields.

    • optionalkeyword-onlybom: bool = False

      Include or exclude UTF-8 BOM; default behavior varies by format.

    • optionalkeyword-onlydelimiter: str | None = None

      Delimiter character for CSV; default is ','.

    • optionalkeyword-onlyfields: list[str] | None = None

      List of fields to include in the results.

    • optionalkeyword-onlyomit: list[str] | None = None

      List of fields to omit from the results.

    • optionalkeyword-onlyunwind: str | None = None

      Unwinds a field into separate records.

    • optionalkeyword-onlyskip_empty: bool = False

      If True, skips empty items in the output.

    • optionalkeyword-onlyskip_header_row: bool = False

      If True, skips the header row in CSV.

    • optionalkeyword-onlyskip_hidden: bool = False

      If True, skips hidden fields in the output.

    • optionalkeyword-onlyxml_root: str | None = None

      Root element name for XML output; default is 'items'.

    • optionalkeyword-onlyxml_row: str | None = None

      Element name for each item in XML output; default is 'item'.

    • optionalkeyword-onlyflatten: list[str] | None = None

      List of fields to flatten.

    Returns bytes

iterate_items

  • async iterate_items(*, offset, limit, clean, desc, fields, omit, unwind, skip_empty, skip_hidden): AsyncIterator[dict]
  • Iterates over items in the dataset according to specified filters and sorting.

    This method allows for asynchronously iterating through dataset items while applying various filters such as skipping empty items, hiding specific fields, and sorting. It supports pagination via offset and limit parameters, and can modify the appearance of dataset items using fields, omit, unwind, skip_empty, and skip_hidden parameters.


    Parameters

    • optionalkeyword-onlyoffset: int = 0

      The number of initial items to skip.

    • optionalkeyword-onlylimit: int | None = None

      The maximum number of items to iterate over. None means no limit.

    • optionalkeyword-onlyclean: bool = False

      If True, removes empty items and hidden fields, equivalent to 'skip_hidden' and 'skip_empty'.

    • optionalkeyword-onlydesc: bool = False

      If set to True, items are returned in descending order, i.e., newest first.

    • optionalkeyword-onlyfields: list[str] | None = None

      Specifies a subset of fields to include in each item.

    • optionalkeyword-onlyomit: list[str] | None = None

      Specifies a subset of fields to exclude from each item.

    • optionalkeyword-onlyunwind: str | None = None

      Specifies a field that should be unwound into separate items.

    • optionalkeyword-onlyskip_empty: bool = False

      If set to True, omits items that are empty after other filters have been applied.

    • optionalkeyword-onlyskip_hidden: bool = False

      If set to True, omits fields starting with the '#' character from the output.

    Returns AsyncIterator[dict]

list_items

  • async list_items(*, offset, limit, clean, desc, fields, omit, unwind, skip_empty, skip_hidden, flatten, view): DatasetItemsListPage
  • Retrieves a paginated list of items from a dataset based on various filtering parameters.

    This method provides the flexibility to filter, sort, and modify the appearance of dataset items when listed. Each parameter modifies the result set according to its purpose. The method also supports pagination through 'offset' and 'limit' parameters.


    Parameters

    • optionalkeyword-onlyoffset: int | None = 0

      The number of initial items to skip.

    • optionalkeyword-onlylimit: int | None = _LIST_ITEMS_LIMIT

      The maximum number of items to return.

    • optionalkeyword-onlyclean: bool = False

      If True, removes empty items and hidden fields, equivalent to 'skip_hidden' and 'skip_empty'.

    • optionalkeyword-onlydesc: bool = False

      If True, items are returned in descending order, i.e., newest first.

    • optionalkeyword-onlyfields: list[str] | None = None

      Specifies a subset of fields to include in each item.

    • optionalkeyword-onlyomit: list[str] | None = None

      Specifies a subset of fields to exclude from each item.

    • optionalkeyword-onlyunwind: str | None = None

      Specifies a field that should be unwound. If it's an array, each element becomes a separate record.

    • optionalkeyword-onlyskip_empty: bool = False

      If True, omits items that are empty after other filters have been applied.

    • optionalkeyword-onlyskip_hidden: bool = False

      If True, omits fields starting with the '#' character.

    • optionalkeyword-onlyflatten: list[str] | None = None

      A list of fields to flatten in each item.

    • optionalkeyword-onlyview: str | None = None

      The specific view of the dataset to use when retrieving items.

    Returns DatasetItemsListPage

push_items

  • async push_items(*, items): None
  • Push items to the dataset.


    Parameters

    • optionalkeyword-onlyitems: JsonSerializable

      The items which to push in the dataset. They must be JSON serializable.

    Returns None

stream_items

  • async stream_items(*, item_format, offset, limit, desc, clean, bom, delimiter, fields, omit, unwind, skip_empty, skip_header_row, skip_hidden, xml_root, xml_row): AbstractAsyncContextManager[Response | None]
  • Retrieves dataset items as a streaming response.


    Parameters

    • optionalkeyword-onlyitem_format: str = 'json'

      Output format, options include json, jsonl, csv, html, xlsx, xml, rss; default is json.

    • optionalkeyword-onlyoffset: int | None = None

      Number of items to skip at the start; default is 0.

    • optionalkeyword-onlylimit: int | None = None

      Maximum number of items to return; no default limit.

    • optionalkeyword-onlydesc: bool = False

      If True, reverses the order of results.

    • optionalkeyword-onlyclean: bool = False

      If True, filters out empty items and hidden fields.

    • optionalkeyword-onlybom: bool = False

      Include or exclude UTF-8 BOM; varies by format.

    • optionalkeyword-onlydelimiter: str | None = None

      Delimiter for CSV files; default is ','.

    • optionalkeyword-onlyfields: list[str] | None = None

      List of fields to include in the output.

    • optionalkeyword-onlyomit: list[str] | None = None

      List of fields to omit from the output.

    • optionalkeyword-onlyunwind: str | None = None

      Unwinds a field into separate records.

    • optionalkeyword-onlyskip_empty: bool = False

      If True, empty items are omitted.

    • optionalkeyword-onlyskip_header_row: bool = False

      If True, skips the header row in CSV.

    • optionalkeyword-onlyskip_hidden: bool = False

      If True, hides fields starting with the # character.

    • optionalkeyword-onlyxml_root: str | None = None

      Custom root element name for XML output; default is 'items'.

    • optionalkeyword-onlyxml_row: str | None = None

      Custom element name for each item in XML; default is 'item'.

    Returns AbstractAsyncContextManager[Response | None]

update

  • Update the dataset metadata.


    Parameters

    • optionalkeyword-onlyname: str | None = None

      New new name for the dataset.

    Returns DatasetMetadata