PyDict

class sources.PyDict

Source reading data from lists of dicts.

sources.PyDict.add_rows(rows)

Add data to the source.

sources.PyDict.create(rows=None, *, time_column, key_column, queryable=True, subsort_column=None, schema=None, grouping_name=None, time_unit=None)

Create a source reading from rows represented as dicts.

Parameters:
  • rows (Optional[dict | list[dict]], default: None)

    The input row(s) as a dictionary or list of dictionaries.

  • time_column (str)

    The name of the column containing the time.

  • key_column (str)

    The name of the column containing the key.

  • queryable (bool, default: True)

    Whether added rows will be available for running queries.

    If True, rows (both provided to the constructor and added later) will be available

    for interactive queries. If False, rows will be discarded after being sent to any

    running materializations. Consider setting this to False when the source will only

    be used for materialization to avoid unnecessary memory usage.

  • subsort_column (Optional[str], default: None)

    The name of the column containing the subsort.

    If not provided, the subsort will be assigned by the system.

  • schema (Optional[Schema], default: None)

    The schema to use. If not provided, it will be inferred from the input.

  • grouping_name (Optional[str], default: None)

    The name of the group associated with each key.

    This is used to ensure implicit joins are only performed between data grouped

    by the same entity.

  • time_unit (Optional[TimeUnit], default: None)

    The unit of the time column. One of ns, us, ms, or s.

    If not specified (and not specified in the data), nanosecond will be assumed.