(model_class, q_expression, annotate=None, query_size=5000,
                                                values=None, load_source=None)
Runs a query across all partitioned databases in small chunks and produces a generator
    with the results.

    :param model_class: A Django model class

    :param q_expression: An instance of django.db.models.Q representing the
    filter to apply

    :param annotate: (optional) If specified, should be a dictionary of annotated fields
    and their calculations. The dictionary will be splatted into the `.annotate` function

    :param values: (optional) If specified, should be a list of values to retrieve rather
    than retrieving entire objects.

    :return: A generator with the results
Runs a query across all partitioned databases in small chunks and produces a generator
    with the results.
Runs a query across all partitioned databases in small chunks and produces a generator with the results .
def paginate_query_across_partitioned_databases(model_class, q_expression, annotate=None, query_size=5000,
                                                values=None, load_source=None):
    """
    Runs a query across all partitioned databases in small chunks and produces a generator
    with the results.

    :param model_class: A Django model class

    :param q_expression: An instance of django.db.models.Q representing the
    filter to apply

    :param annotate: (optional) If specified, should be a dictionary of annotated fields
    and their calculations. The dictionary will be splatted into the `.annotate` function

    :param values: (optional) If specified, should be a list of values to retrieve rather
    than retrieving entire objects.

    :return: A generator with the results
    """
    db_names = get_db_aliases_for_partitioned_query()
    for db_name in db_names:
        for row in paginate_query(db_name, model_class, q_expression, annotate, query_size, values, load_source):
            yield row
def paginate_query_across_partitioned_databases ( model_class , q_expression , annotate = None , query_size = 5000 , values = None , load_source = None ) : db_names = get_db_aliases_for_partitioned_query ( ) for db_name in db_names : for row in paginate_query ( db_name , model_class , q_expression , annotate , query_size , values , load_source ) : yield row