You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to implement a soft delete in one of my Resources. First choice would have been use Eve's soft delete but it is not possible because of #109 (#167).
However, the query class ends up being flask-sqlalchemy's BaseQuery. Could it be that eve-sqlalchemy is forcing it, instead of allowing the custom query_class? Any direction on this item could be very helpful.
There is a difference that might be important for this, my models inherit from Base=sqlalchemy.ext.declarative.declarative_base() while flask-sqlalchemy typicall boilerplate models inherit from db.Model wher db=flask_sqlalchemy.SQLAlchemy().
I also tried to hardcoded the queryclass in Eve-sqlalchemy db init: db = flask_sqlalchemy.SQLAlchemy(query_class=QueryWithSoftDelete)`` but I get the following error: sqlalchemy.exc.InvalidRequestError: Query.select_from() being called on a Query with existing criterion.```
While I would like to be able to define a custom query_class for any case scenario, I would be happy to look into allow Eve's soft delete, so I would be open to contribute provide some guidance.
Thanks for any help!
The text was updated successfully, but these errors were encountered:
I want to implement a soft delete in one of my Resources. First choice would have been use Eve's soft delete but it is not possible because of #109 (#167).
I tried to implement a Flask-SQL Alchemy solution as proposed by Flask' contributor Miguel Grindberg:
https://github.com/miguelgrinberg/sqlalchemy-soft-delete/blob/master/app.py
I tried to define the query_class in several places: db.Model, the model, the Abstract clas, declarative_base... A sample of it is:
However, the query class ends up being flask-sqlalchemy's BaseQuery. Could it be that eve-sqlalchemy is forcing it, instead of allowing the custom query_class? Any direction on this item could be very helpful.
There is a difference that might be important for this, my models inherit from
Base=sqlalchemy.ext.declarative.declarative_base()
while flask-sqlalchemy typicall boilerplate models inherit from db.Model wherdb=flask_sqlalchemy.SQLAlchemy()
.I also tried to hardcoded the queryclass in Eve-sqlalchemy db init:
db = flask_sqlalchemy.SQLAlchemy(query_class=QueryWithSoftDelete)`` but I get the following error:
sqlalchemy.exc.InvalidRequestError: Query.select_from() being called on a Query with existing criterion.```While I would like to be able to define a custom query_class for any case scenario, I would be happy to look into allow Eve's soft delete, so I would be open to contribute provide some guidance.
Thanks for any help!
The text was updated successfully, but these errors were encountered: