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

  • async get(): DatasetMetadata | None
  • 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

    • keyword-onlyitem_format: str = 'json'

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

    • keyword-onlyoffset: int | None = None

      Number of items to skip; default is 0.

    • keyword-onlylimit: int | None = None

      Max number of items to return; no default limit.

    • keyword-onlydesc: bool = False

      If True, results are returned in descending order.

    • keyword-onlyclean: bool = False

      If True, filters out empty items and hidden fields.

    • keyword-onlybom: bool = False

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

    • keyword-onlydelimiter: str | None = None

      Delimiter character for CSV; default is ','.

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

      List of fields to include in the results.

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

      List of fields to omit from the results.

    • keyword-onlyunwind: str | None = None

      Unwinds a field into separate records.

    • keyword-onlyskip_empty: bool = False

      If True, skips empty items in the output.

    • keyword-onlyskip_header_row: bool = False

      If True, skips the header row in CSV.

    • keyword-onlyskip_hidden: bool = False

      If True, skips hidden fields in the output.

    • keyword-onlyxml_root: str | None = None

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

    • keyword-onlyxml_row: str | None = None

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

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

      List of fields to flatten.

    Returns bytes

    The dataset items as raw 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

    • keyword-onlyoffset: int = 0

      The number of initial items to skip.

    • keyword-onlylimit: int | None = None

      The maximum number of items to iterate over. Defaults to no limit.

    • keyword-onlyclean: bool = False

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

    • keyword-onlydesc: bool = False

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

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

      Specifies a subset of fields to include in each item.

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

      Specifies a subset of fields to exclude from each item.

    • keyword-onlyunwind: str | None = None

      Specifies a field that should be unwound into separate items.

    • keyword-onlyskip_empty: bool = False

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

    • keyword-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

    • keyword-onlyoffset: int | None = 0

      The number of initial items to skip.

    • keyword-onlylimit: int | None = _LIST_ITEMS_LIMIT

      The maximum number of items to return.

    • keyword-onlyclean: bool = False

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

    • keyword-onlydesc: bool = False

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

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

      Specifies a subset of fields to include in each item.

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

      Specifies a subset of fields to exclude from each item.

    • keyword-onlyunwind: str | None = None

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

    • keyword-onlyskip_empty: bool = False

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

    • keyword-onlyskip_hidden: bool = False

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

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

      A list of fields to flatten in each item.

    • keyword-onlyview: str | None = None

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

    Returns DatasetItemsListPage

    An object with filtered, sorted, and paginated dataset items plus pagination details.

push_items

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


    Parameters

    • items: 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): AsyncContextManager[Response | None]
  • Retrieves dataset items as a streaming response.


    Parameters

    • keyword-onlyitem_format: str = 'json'

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

    • keyword-onlyoffset: int | None = None

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

    • keyword-onlylimit: int | None = None

      Maximum number of items to return; no default limit.

    • keyword-onlydesc: bool = False

      If True, reverses the order of results.

    • keyword-onlyclean: bool = False

      If True, filters out empty items and hidden fields.

    • keyword-onlybom: bool = False

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

    • keyword-onlydelimiter: str | None = None

      Delimiter for CSV files; default is ','.

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

      List of fields to include in the output.

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

      List of fields to omit from the output.

    • keyword-onlyunwind: str | None = None

      Unwinds a field into separate records.

    • keyword-onlyskip_empty: bool = False

      If True, empty items are omitted.

    • keyword-onlyskip_header_row: bool = False

      If True, skips the header row in CSV.

    • keyword-onlyskip_hidden: bool = False

      If True, hides fields starting with the # character.

    • keyword-onlyxml_root: str | None = None

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

    • keyword-onlyxml_row: str | None = None

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

    Returns AsyncContextManager[Response | None]

update

  • Update the dataset metadata.


    Parameters

    • keyword-onlyname: str | None = None

      New new name for the dataset.

    Returns DatasetMetadata

    An object reflecting the updated dataset metadata.