(iteration_key, reindex_accessor, chunk_size=100, event_handler=None,
                                 transform=None)
return ResumableModelIterator(iteration_key, data_function, args_provider, event_handler)
Perform one-time resumable iteration over documents

    Iteration can be efficiently stopped and resumed. The iteration may
    omit documents that are added after the iteration begins or resumes
    and may include deleted documents.

    :param iteration_key: A unique key identifying the iteration. This
    key will be used in combination with `doc_types` to maintain state
    about an iteration that is in progress. The state will be maintained
    indefinitely unless it is removed with `discard_state()`.
    :param reindex_accessor: A ``ReindexAccessor`` object.
    :param chunk_size: Number of documents to yield before updating the
    iteration checkpoint. In the worst case about this many documents
    that were previously yielded may be yielded again if the iteration
    is stopped and later resumed.
Perform one-time resumable iteration over documents
Perform one - time resumable iteration over documents
def resumable_sql_model_iterator(iteration_key, reindex_accessor, chunk_size=100, event_handler=None,
                                 transform=None):
    """Perform one-time resumable iteration over documents

    Iteration can be efficiently stopped and resumed. The iteration may
    omit documents that are added after the iteration begins or resumes
    and may include deleted documents.

    :param iteration_key: A unique key identifying the iteration. This
    key will be used in combination with `doc_types` to maintain state
    about an iteration that is in progress. The state will be maintained
    indefinitely unless it is removed with `discard_state()`.
    :param reindex_accessor: A ``ReindexAccessor`` object.
    :param chunk_size: Number of documents to yield before updating the
    iteration checkpoint. In the worst case about this many documents
    that were previously yielded may be yielded again if the iteration
    is stopped and later resumed.
    """
    NULL = object()

    def data_function(from_db, filter_value, last_id=NULL):
        if last_id is NULL:
            # adapt to old iteration states
            last_id = filter_value
        return reindex_accessor.get_docs(from_db, last_id, limit=chunk_size)

    args_provider = SqlModelArgsProvider(reindex_accessor.sql_db_aliases)

    if not transform:
        def transform(doc):
            return reindex_accessor.doc_to_json(doc)

    class ResumableModelIterator(ResumableFunctionIterator):
        def __iter__(self):
            for doc in super(ResumableModelIterator, self).__iter__():
                yield transform(doc)

    return ResumableModelIterator(iteration_key, data_function, args_provider, event_handler)
def resumable_sql_model_iterator ( iteration_key , reindex_accessor , chunk_size = 100 , event_handler = None , transform = None ) : NULL = object ( ) def data_function ( from_db , filter_value , last_id = NULL ) : if last_id is NULL : # adapt to old iteration states last_id = filter_value return reindex_accessor . get_docs ( from_db , last_id , limit = chunk_size ) args_provider = SqlModelArgsProvider ( reindex_accessor . sql_db_aliases ) if not transform : def transform ( doc ) : return reindex_accessor . doc_to_json ( doc ) class ResumableModelIterator ( ResumableFunctionIterator ) : def __iter__ ( self ) : for doc in super ( ResumableModelIterator , self ) . __iter__ ( ) : yield transform ( doc ) return ResumableModelIterator ( iteration_key , data_function , args_provider , event_handler )