tuomur / python-odata

A simple library for read/write access to OData services
MIT License
79 stars 59 forks source link

Documentation on adding new records into entity? #21

Closed rjjanuary closed 6 years ago

rjjanuary commented 6 years ago

I'm currently able to read and update items from an OData source using python-odata, however I'm struggling with the understanding of how to add new records to entities after using reflection to enumerate the service. Is there any documentation available that would assist in this process?

tuomur commented 6 years ago

I'm not sure what you mean by "adding records".

rjjanuary commented 6 years ago

I apologize for the confusion. My issue was the ability of adding an entity to an entity set. I didn't understand the naming of the convention enough to adequately search. Ultimately I resolved the issue once I understood the OData concepts better.

joshkyh commented 2 years ago

I also had this question, and managed to resolve it by reading:

  1. test_create in https://github.com/tuomur/python-odata/blob/f2afea874d9788931b0a3ac1a49a7d20119d4544/odata/tests/test_objects.py
  2. The necessary attributes within Product Class in https://github.com/tuomur/python-odata/blob/f2afea874d9788931b0a3ac1a49a7d20119d4544/odata/tests/__init__.py
  3. The demo meta data in https://github.com/tuomur/python-odata/blob/f2afea874d9788931b0a3ac1a49a7d20119d4544/odata/tests/demo_metadata.xml

At a high level, one needs to instantiate a custom Service.Entity. Populate the non-id fields and use Service.save