Skip to content

Commit

Permalink
Removed sqlalchemy-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniket Singh Rawat authored and pavish committed Nov 22, 2023
1 parent aba1679 commit 7a79231
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 2 additions & 6 deletions db/records/operations/relevance.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from sqlalchemy import case, select
from sqlalchemy_filters import apply_sort
from sqlalchemy import case, select, desc
from db.types import categories
from db.types.operations.convert import get_db_type_enum_from_class

Expand All @@ -18,10 +17,7 @@ def get_rank_and_filter_rows_query(relation, parameters_dict, limit=10):
parameters given in parameters_dict.
"""
rank_cte = _get_scored_selectable(relation, parameters_dict)
filtered_ordered_cte = apply_sort(
select(rank_cte).where(rank_cte.columns[SCORE_COL] > 0),
{'field': SCORE_COL, 'direction': 'desc'}
).cte()
filtered_ordered_cte = select(rank_cte).where(rank_cte.columns[SCORE_COL] > 0).order_by(desc(SCORE_COL)).cte()
return select(
*[filtered_ordered_cte.columns[c] for c in [col.name for col in relation.columns]]
).limit(limit)
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ responses==0.22.0
SQLAlchemy-Utils==0.38.2
thefuzz==0.19.0
whitenoise==6.4.0
git+https://github.com/mathesar-foundation/sqlalchemy-filters@models_to_tables#egg=sqlalchemy_filters
gunicorn==20.1.0
drf-spectacular==0.26.2
pandas==2.0.2
Expand Down

0 comments on commit 7a79231

Please sign in to comment.