Is there a FIRST WHERE filter available via the API? I’ve done row, equals and I think it’s taking a long time because I have 250,000 rows and baserow is looking for all matches. I just need the first.
def get_matching_table_records(table_id, filter_field, filter_value, comparison_type='equal', order_by=None):
"""
Fetch filtered records from a specific table in Baserow, with an option to specify the filter condition type and sorting.
:param table_id: The ID of the table to query.
:param filter_field: The field to filter by.
:param filter_value: The value to filter by.
:param condition_type: The type of condition to apply (e.g., 'equal', 'single_select_equal').
:param order_by: Optional field or fields to sort by.
:return: A list of records that match the filter criteria.
"""
url = BASE_URL.format(table_id=table_id)
filters_param = json.dumps({
"filter_type": "AND",
"filters": [{"type": comparison_type, "field": filter_field, "value": filter_value}],
"groups": []
})
params = {
'user_field_names': 'true',
'filters': filters_param
}
if order_by:
params['order_by'] = order_by
records = fetch_paginated_data(url, params)
return records