Open virtualvinodh opened 3 years ago
I fixed this by adding a bunch of conditionals at sqlalchemy.ext.declarative.base
I'm sure this isn't the right way to do this.
Line: 386
cls_ = type(self)
for k in kwargs:
if k == "_updated" or k == "_created" or k=="_etag":
pass
elif not hasattr(cls_, k):
raise TypeError(
"%r is an invalid keyword argument for %s" % (k, cls_.__name__)
)
setattr(self, k, kwargs[k])
You haven't created _updated
field in your Network
class which is necessary for POST operations as it is part of Eve core functionality.
From Eve-sqlalchemy tutorial (https://eve-sqlalchemy.readthedocs.io/en/latest/tutorial.html#eve-settings):
We have used CommonColumns abstract class to provide attributes used by Eve, such as _created and _updated. These are not needed if you are only reading from the database. However, if your API is also writing to the database, then you need to include them.
Hi,
When I try to post a JSON payload via my endpoint /network, I get the following error.
TypeError: '_updated' is an invalid keyword argument for Network
I would assume that inserting into the DB via POST should be fairly trivial without requiring anything else.Am I missing any additional configuration at all?
Eve v0.7.10 Eve-SQLAlchemy v0.7.1 Flask:0.12 Werkzeug: 0.11.15
Thanks!
Full error message is here: https://gist.github.com/virtualvinodh/ced063f382a2cd1c397cee28f736b9ea