def dataset_rows_select_from_ids(
        self,
        query: sa.Select,
        ids: Iterable[RowsOutput],
        is_batched: bool,
    ) -> Iterator[RowsOutput]:
        """
        Fetch dataset rows from database using a list of IDs.
        """
        if (id_col := get_query_id_column(query)) is None:
            raise RuntimeError("sys__id column not found in query")

        if is_batched:
            for batch in ids:
                yield list(self.dataset_rows_select(query.where(id_col.in_(batch))))
        else:
            yield from self.dataset_rows_select(query.where(id_col.in_(ids)))

        Fetch dataset rows from database using a list of IDs.
        
src/datachain/data_storage/warehouse.py