Closed mgarfias closed 7 years ago
Can you check your settings against newest 0.3 version of eve-sqlalchemy?
$ pip freeze | grep Eve-SQL Eve-SQLAlchemy==0.3
Results in the same error: { "_status": "ERR", "_issues": { "body_id": "value '37' cannot be converted to a ObjectId" }, "_error": { "message": "Insertion failure: 1 document(s) contain(s) error(s)", "code": 422 } }
(body_id has changed due to auto_increments/testing other stuff).
I also encountered the same issue. I was not able to POST a new document when there was a foreign key constrain in the Table definition, without no problem.
This works perfectly for me - the resource is created. Is this still a problem?
@vlasy Hopefully not. Which version of Eve SQLAlchemy did you try?
I haven't tried POSTing recently, but it worked on my forked repo. Forked from version 0.4.2.dev0. However, I did have to add support for polymorphic inserts.
@dkellner Eve-SQLAlchemy==0.4.2.dev0
OK, so I will close this as this should be fixed by now.
Error is:
Relevant tables:
Bits from settings.py:
Body of the POST:
GET Request for http://localhost:5000/bodies/1 results in:
I feel like I'm missing something obvious here, but none of the eve-sqlalchemy examples even mentions an insert via POST, only using sqlalchemy to do the inserts for the example data.