def _get_delta_chain(
    source_ds_name: str,
    source_ds_version: str,
    source_ds_latest_version: str,
    on: Union[str, Sequence[str]],
    compare: Optional[Union[str, Sequence[str]]] = None,
) -> "DataChain":
    """Get delta chain for processing changes between versions."""
    source_dc = datachain.read_dataset(source_ds_name, source_ds_version)
    source_dc_latest = datachain.read_dataset(source_ds_name, source_ds_latest_version)

    # Calculate diff between source versions
    return source_dc_latest.compare(source_dc, on=on, compare=compare, deleted=False)
Get delta chain for processing changes between versions.
src/datachain/delta.py