Closed vsobolmaven closed 7 years ago
I am able to return additional attribute that is not mapped to ORM
But I am not using the style you suggested above.
Instead I am using on_fetched
hook to append additional attributes to the response.
Instead of using the on_fetched
hook you can add the column to the projection, too.
@dkellner Can you give an example how projection could be used to "insert" additional data that is not part of the DB ?
Extending trivial.py:
class People(Base):
# ...
@property
def foo(self):
return "bar"
SETTINGS['DOMAIN']['people']['datasource']['projection']['foo'] = 1
If you want to add fields that are not part of the People
class, you're out of luck with projections. In this case you have to resort to the event system.
Does eve-sqlalchemy allow to define an attribute on a resource class and return it in a result for GET request if the attribute is not mapped to ORM? e.g.
I need the property value as part of response with resource. Is this supported? Thanks!