diff --git a/common/database_helpers.py b/common/database_helpers.py index cffcf83e..956ad37e 100644 --- a/common/database_helpers.py +++ b/common/database_helpers.py @@ -144,6 +144,15 @@ def apply_filter(self, query): raise BadFilterError(f" Bad filter: {self.direction}") +class LimitFilter(QueryFilter): + def __init__(self, limit_value): + self.limit_value = limit_value + + def apply_filter(self, query): + query.base_query = query.base_query.limit(self.limit_value) + query.is_limited = True + + def insert_row_into_table(row): """ Insert the given row into its table