read_snapshots
The read_snapshots function reads a snapshot file for a given stream and returns it as either a Polars DataFrame or Lazyframe.
-
Parameters:
stream: The name of the stream to read the snapshot for. For example, ‘contacts’.snapshot_dir: The path to the directory where snapshot files are stored.
-
Example:
snapshot_records
The snapshot_records function updates a snapshot file with new data for a given stream and returns a merged Polars DataFrame or Lazyframe.
-
Parameters:
stream_data: DataFrame (or Lazyframe) containing the new data to be merged.stream: The name of the stream for the snapshots, e.g., ‘contacts’.snapshot_dir: Path to the directory where snapshot files are stored.pk: Primary key(s) to use when merging snapshot; can be a string or a list of strings.just_new: If True, returns just the new data, otherwise returns all merged data.use_csv: If True, saves and reads snapshots in CSV format instead of Parquet.overwrite: If True, overwrites existing snapshot files instead of merging.
-
Example: