Use sa-filters instead of sqlalchemy-filters for API queries

latter was abandoned it seems; former has support for SQLAlchemy 1.4
and looks to be a drop-in replacement

another option, if needed at some point, though i like the looks of it
less, is https://sqlalchemy-filters-plus.readthedocs.io/

see also:

https://github.com/juliotrigo/sqlalchemy-filters/pull/69
https://github.com/juliotrigo/sqlalchemy-filters/issues/72
This commit is contained in:
Lance Edgar 2023-02-11 11:51:43 -06:00
parent c87c50bfb9
commit 5736faf24c
2 changed files with 3 additions and 7 deletions

View file

@ -96,7 +96,7 @@ requires = [
'pyramid_tm', # 0.3
'rattail[db,bouncer]', # 0.5.0
'six', # 1.10.0
'sqlalchemy-filters', # 0.8.0
'sa-filters', # 1.2.0
'transaction', # 1.2.0
'waitress', # 0.8.1
'WebHelpers2', # 2.0

View file

@ -24,12 +24,8 @@
Tailbone Web API - Master View
"""
from __future__ import unicode_literals, absolute_import
import json
import six
from rattail.config import parse_bool
from rattail.db.util import get_fieldnames
@ -279,7 +275,7 @@ class APIMasterView(APIView):
return self._fieldnames
def normalize(self, obj):
data = {'_str': six.text_type(obj)}
data = {'_str': str(obj)}
for field in self.get_fieldnames():
data[field] = getattr(obj, field)
@ -287,7 +283,7 @@ class APIMasterView(APIView):
return data
def _collection_get(self):
from sqlalchemy_filters import apply_filters, apply_sort, apply_pagination
from sa_filters import apply_filters, apply_sort, apply_pagination
query = self.base_query()
context = {}