pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
232 stars 70 forks source link

Return everything as dicts instead of SQLAResult #21

Closed cburchert closed 9 years ago

cburchert commented 9 years ago

As Eve is ignorant of how we return objects(from find, find_one) it manipulates objects as if they were dicts which are independent of the database. SQLAResult propagates all changes to the database. This creates many issues and might create even more in the future.

See also issue #11

  1. As the SQLAResult objects don't know about embedding or projection both these features don't work at all.
  2. Some requests fail when updating etags because the custom json serializer is not used when calculating etags and SQLAResult objects can't be serialized. (This is also why unit tests fail, an easy way to see the problem).
  3. Requests to one resource sometimes return objects of a different resource, when those where loaded during hooks.
  4. Hooks which have an original and updated parameter don't work. As every object is attached to the database both parameters will be the same.

Also with dicts we don't need jsonify functions at all, which simplifies code of models.

This commit will remove the SQLAResult class and thereby fix all of these issues.