Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling deferred attributes automatically #118

Open
bartonip opened this issue Jul 20, 2020 · 1 comment
Open

Handling deferred attributes automatically #118

bartonip opened this issue Jul 20, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@bartonip
Copy link
Contributor

bartonip commented Jul 20, 2020

Right now if an entity has a navigation property, the object must be completely reloaded (as below) to load in deferred data in navigation properties. For example:

orders = service.orders.get_entities()

for o in orders:
    do_some_stuff_with(o.Customers)  # This is an empty list right now so nothing will get done.

# The data must be reloaded as per the below for anything to happen.
orders = service.orders.get_entities().expand("Customers")

I propose that we use the OData __deferred attribute to fire a request on demand to load these attributes in. This would allow the API to look like this:

orders = service.orders.get_entities()

for o in orders:
   do_some_stuff_with(o.Customers)  # Request is automatically made using the `__deferred` attribute which transparently offers the missing data back to the class.

WDYT: @filak-sap

@filak-sap
Copy link
Contributor

I am not against it as long as we keep also the possibility to fetch the navigation property using the standard way which allows us to specify HTTP parameters.

@filak-sap filak-sap added the enhancement New feature or request label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants