@stream_session
def list_datasets_per_rse(rse_id, filters=None, limit=None, session=None):
    '\n    List datasets at a RSE.\n\n    :param rse: the rse id.\n    :param filters: dictionary of attributes by which the results should be filtered.\n    :param limit: limit number.\n    :param session: Database session to use.\n\n    :returns: A list of dict dataset replicas\n    '
    query = session.query(models.CollectionReplica.scope, models.CollectionReplica.name, models.RSE.id.label('rse_id'), models.RSE.rse, models.CollectionReplica.bytes, models.CollectionReplica.length, models.CollectionReplica.available_bytes, models.CollectionReplica.available_replicas_cnt.label('available_length'), models.CollectionReplica.state, models.CollectionReplica.created_at, models.CollectionReplica.updated_at, models.CollectionReplica.accessed_at).filter_by(did_type=DIDType.DATASET).filter((models.CollectionReplica.rse_id == models.RSE.id)).filter((models.RSE.id == rse_id)).filter((models.RSE.deleted == false()))
    for (k, v) in ((filters and filters.items()) or []):
        if ((k == 'name') or (k == 'scope')):
            v_str = (v if (k != 'scope') else v.internal)
            if (('*' in v_str) or ('%' in v_str)):
                if (session.bind.dialect.name == 'postgresql'):
                    query = query.filter(getattr(models.CollectionReplica, k).like(v_str.replace('*', '%')))
                else:
                    query = query.filter(getattr(models.CollectionReplica, k).like(v_str.replace('*', '%'), escape='\\'))
            else:
                query = query.filter((getattr(models.CollectionReplica, k) == v))
        elif (k == 'created_before'):
            created_before = str_to_date(v)
            query = query.filter((models.CollectionReplica.created_at <= created_before))
        elif (k == 'created_after'):
            created_after = str_to_date(v)
            query = query.filter((models.CollectionReplica.created_at >= created_after))
        else:
            query = query.filter((getattr(models.CollectionReplica, k) == v))
    if limit:
        query = query.limit(limit)
    for row in query:
        (yield row._asdict())
List datasets at a RSE.

:param rse: the rse id.
:param filters: dictionary of attributes by which the results should be filtered.
:param limit: limit number.
:param session: Database session to use.

:returns: A list of dict dataset replicas
@stream_session
def list_datasets_per_rse(rse_id, filters=None, limit=None, session=None):
    '\n    List datasets at a RSE.\n\n    :param rse: the rse id.\n    :param filters: dictionary of attributes by which the results should be filtered.\n    :param limit: limit number.\n    :param session: Database session to use.\n\n    :returns: A list of dict dataset replicas\n    '
    query = session.query(models.CollectionReplica.scope, models.CollectionReplica.name, models.RSE.id.label('rse_id'), models.RSE.rse, models.CollectionReplica.bytes, models.CollectionReplica.length, models.CollectionReplica.available_bytes, models.CollectionReplica.available_replicas_cnt.label('available_length'), models.CollectionReplica.state, models.CollectionReplica.created_at, models.CollectionReplica.updated_at, models.CollectionReplica.accessed_at).filter_by(did_type=DIDType.DATASET).filter((models.CollectionReplica.rse_id == models.RSE.id)).filter((models.RSE.id == rse_id)).filter((models.RSE.deleted == false()))
    for (k, v) in ((filters and filters.items()) or []):
        if ((k == 'name') or (k == 'scope')):
            v_str = (v if (k != 'scope') else v.internal)
            if (('*' in v_str) or ('%' in v_str)):
                if (session.bind.dialect.name == 'postgresql'):
                    query = query.filter(getattr(models.CollectionReplica, k).like(v_str.replace('*', '%')))
                else:
                    query = query.filter(getattr(models.CollectionReplica, k).like(v_str.replace('*', '%'), escape='\\'))
            else:
                query = query.filter((getattr(models.CollectionReplica, k) == v))
        elif (k == 'created_before'):
            created_before = str_to_date(v)
            query = query.filter((models.CollectionReplica.created_at <= created_before))
        elif (k == 'created_after'):
            created_after = str_to_date(v)
            query = query.filter((models.CollectionReplica.created_at >= created_after))
        else:
            query = query.filter((getattr(models.CollectionReplica, k) == v))
    if limit:
        query = query.limit(limit)
    for row in query:
        (yield row._asdict())