class_docstr: Datasets records DAO
class_docstr_tok: ["Datasets","records","DAO"]
docstr: Iterates over a dataset records
  
  Parameters
  ----------
  dataset:
      The dataset
  search:
      The search parameters. Optional
  limit:
      Batch size to extract, only works if an `id_from` is provided
  id_from:
      From which ID should we start iterating
  include_fields:
      A set of record fields to retrieve. Wildcard are allowed
  exclude_fields:
      A set of record fields to exclude. Wildcard are allowed
  
  Returns
  -------
      An iterable over found dataset records
docstr_tok: ["Iterates","over","a","dataset","records","Parameters","--","--","--","--","--","dataset",":","The","dataset","search",":","The","search","parameters",".","Optional","limit",":","Batch","size","to","extract",",","only","works","if","an","`","id_from","`","is","provided","id_from",":","From","which","ID","should","we","start","iterating","include_fields",":","A","set","of","record","fields","to","retrieve",".","Wildcard","are","allowed","exclude_fields",":","A","set","of","record","fields","to","exclude",".","Wildcard","are","allowed","Returns","--","--","--","-","An","iterable","over","found","dataset","records"]
code: def scan_dataset(
      self,
      dataset: DatasetDB,
      search: Optional[DaoRecordsSearch] = None,
      limit: Optional[int] = 1000,
      id_from: Optional[str] = None,
      include_fields: Optional[Set[str]] = None,
      exclude_fields: Optional[Set[str]] = None,
  ) -> Iterable[Dict[str, Any]]:
      """
      Iterates over a dataset records
  
      Parameters
      ----------
      dataset:
          The dataset
      search:
          The search parameters. Optional
      limit:
          Batch size to extract, only works if an `id_from` is provided
      id_from:
          From which ID should we start iterating
      include_fields:
          A set of record fields to retrieve. Wildcard are allowed
      exclude_fields:
          A set of record fields to exclude. Wildcard are allowed
  
      Returns
      -------
          An iterable over found dataset records
      """
  
      search = search or DaoRecordsSearch()
      next_search_params = [id_from] if id_from else None
      paginated_sort = PaginatedSortInfo(
          sort_by=[SortableField(id="id")],
          shuffle=search.sort.shuffle,
          next_search_params=next_search_params,
      )
  
      return self._es.scan_records(
          id=dataset.id,
          query=search.query,
          sort=paginated_sort,
          limit=limit,
          include_fields=list(include_fields)
          if include_fields
          else None,
          exclude_fields=list(exclude_fields)
          if exclude_fields
          else None,
      )
  
file_path: argilla/src/argilla/server/daos/records.py
imports: import datetime
  from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type
  from fastapi import Depends
  from argilla.server.daos.backend import GenericElasticEngineBackend
  from argilla.server.daos.backend.base import ClosedIndexError, IndexNotFoundError
  from argilla.server.daos.backend.generic_elastic import PaginatedSortInfo
  from argilla.server.daos.backend.search.model import BaseRecordsQuery, SortableField
  from argilla.server.daos.models.datasets import DatasetDB
  from argilla.server.daos.models.records import DaoRecordsSearch, DaoRecordsSearchResults, RecordDB
  from argilla.server.errors import ClosedDatasetError, MissingDatasetRecordsError
label_desc: Use image node_id 7 for calling the DatasetRecordsDAO obj's underlying member method code with example usage: obj.scan_dataset(dataset, search, limit, id_from, include_fields, exclude_fields) and returns: self