mrevutskyi / flask-restless-ng

A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.
https://flask-restless-ng.readthedocs.io
Other
64 stars 11 forks source link

Exception thrown on column_property #35

Closed avclicky closed 1 year ago

avclicky commented 2 years ago

Greetings,

Thank you for this project. When working with models utilizing column_property, my program throws the following exception:

AttributeError: Neither 'Label' object nor 'Comparator' object has an attribute 'onupdate'

This can be traced to ./views/helpers.py. A simple proposed fix to changes_on_update () is below:

return any(hasattr(column, 'onupdate') and column.onupdate is not None for column in sqlalchemy_inspect(model).columns)

This change ensures that a respective column has the onupdate attribute to begin with before evaluating it.

I'm not familiar enough with SQLAlchemy internals to know if the above change has unintended side-effects, but it has ostensibly solved my problem.

mrevutskyi commented 1 year ago

Hi, thank you for the report, and sorry for the late response.

Is there a way I can reproduce the error?

mrevutskyi commented 1 year ago

or could you please provide a full stacktrace?