Datasets Server provides a /filter endpoint for filtering rows in a dataset.
This guide shows you how to use Datasets Server’s /filter endpoint to filter rows based on a query string.
Feel free to also try it out with ReDoc.
The /filter endpoint accepts the following query parameters:
dataset: the dataset name, for example glue or mozilla-foundation/common_voice_10_0config: the configuration name, for example colasplit: the split name, for example trainwhere: the filter conditionoffset: the offset of the slice, for example 150length: the length of the slice, for example 10 (maximum: 100)The where parameter must be expressed as a comparison predicate, which can be:
=, <>, >, >=, <, <=AND, OR, NOTFor example, the following where parameter value
where=age>30 AND (name='Simone' OR children=0)will filter the data to select only those rows where the float “age” column is larger than 30 and, either the string “name” column is equal to ‘Simone’ or the integer “children” column is equal to 0.
'Scarlett'.
Additionally, if the string value contains a single quote, it must be escaped with another single quote,
for example: 'O''Hara'.If the result has partial: true it means that the filtering couldn’t be run on the full dataset because it’s too big.
Indeed, the indexing for /filter can be partial if the dataset is bigger than 5GB. In that case, it only uses the first 5GB.