jfinkels / flask-restless

NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.
https://flask-restless.readthedocs.io
GNU Affero General Public License v3.0
1.02k stars 301 forks source link

query._limit is not anymore defined in sqlalchemy #702

Open Cabu opened 2 years ago

Cabu commented 2 years ago

flask_restless/views/helpers.py use query._limit who is not anymore a Query class method in sqlalchemy since 24 may 2021.

mot3 commented 2 years ago

Yes, I have the same issue

amanve commented 2 years ago

is it resolved? move to - https://github.com/mrevutskyi/flask-restless-ng

Cabu commented 2 years ago

is it resolved? move to - https://github.com/mrevutskyi/flask-restless-ng

I tried flask-restless-ng, but if my memory is still good about it, is too NG and too much change to the API to be a drop-in replacement that work :(

I 'solved' my problem by 'hotpatching' flask_sqlalchemy after its import in my main program:

import flask_sqlalchemy import SQLAlchemy, BaseQuery

def _limit(self):
    return self.limit()

setattr(BaseQuery, '_Limit', _Limit)
amanve commented 2 years ago

it's ok if the project is old one. but for someone new learner/project we can move to NG not an issue any is preferred.