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

Extra API calls when getting attributes of Cell instance #123

Open
demalexx opened this issue Sep 19, 2017 · 5 comments
Open

Extra API calls when getting attributes of Cell instance #123

demalexx opened this issue Sep 19, 2017 · 5 comments
Milestone

Comments

@demalexx
Copy link

In 1.1.3 method get_all_values(returnas='cell') does retrieve all cell's attributes in single API call. But this isn't useful because when you access attribute of such cell, internal code does fetch as separate API call for every cell. This happens even when Cell instance has all the attributes from Spreadsheet.

Example:

cells = sheet.get_all_values(returnas='cell')  # single API call to get all cells with all its attributes - cool
print(cells[0][0].color)  # color property calls fetch which leads to Spreadsheets API call - not cool
print(cells[0][1].color)  # another API call - not cool
# etc
print(cells[0][2]._color)  # no API call, _color has value from Spreadsheet
@nithinmurali
Copy link
Owner

Even it was a bit of dilemma for me when adding this constant api calling for each property access. The api call for each and every property access is to check if the attribute is changed (by another app/ web interface) after you created the cell/ or last fetch. Without this the user would be working with an outdated value of the property. I am not sure which is bad, having more api calls or user working with outdated data.

I tried to implement a simplecell concept to make trade-off between both. But i guess it just made the while thing more complicated. Since you have raised this issue, I think maybe its better to open a poll asking if anyone actually finds this realtime update before each property access useful, if remove them.

@demalexx have you ever found this real-time update useful?

@demalexx
Copy link
Author

This approach makes sense when client works with Spreadsheet that's constantly changing. But this is not my case - I just read cells once and process them in python.
As making many API calls have big and notable drawbacks (e.g. fast API quota exhaustion, big delay up to few seconds on each API call), I'd make this behavior optional. So user needs to turn it on explicitly and constantly have possible problems in mind. Per cell, or per sheet, I don't know. But by default I think it'd be better to turn it off.
As for poll - no, this real-time update is not useful for me :)

@nithinmurali
Copy link
Owner

Hmm, making this explicitly optional, makes more sense. Will have to think about actual implementation though.

@nithinmurali nithinmurali added this to the 1.2.0 milestone Sep 19, 2017
@nithinmurali
Copy link
Owner

Refer #78

@nithinmurali
Copy link
Owner

refer 53411d8

@nithinmurali nithinmurali modified the milestones: 1.2.0, 1.2.1 Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants