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

FEATURE: Add option to fetch spreasheet state every time it is requested #1212

Closed
alifeee opened this issue Jun 7, 2023 · 4 comments
Closed
Milestone

Comments

@alifeee
Copy link
Collaborator

alifeee commented Jun 7, 2023

Worksheet has many @propertys. These are changed only on initialisation of the object, and when they are updated with the API.

However, due to the nature of collaborative files, they could change without the object knowing.

Thus, we could have an option for the object to call the API every time one of these properties is asked for.

Copy

The following is copied from #1201

Perhaps, we could change them so they are always the "newest" when asked for. So, instead of

current

    @property
    def title(self):
        """Worksheet title."""
        return self._properties["title"]

new

    @property
    def title(self):
        """Worksheet title."""
        return self._get_sheet_property(self, "title", "")

In the next major release (or later) we can think a new way to initiate a Spreadsheet and a Worksheet and offer the choice to either:

  • pull data every times we need it.
  • only pull date the first time and that's it (ex: for user who know they only interact with the spreadsheet using the current script).

it will be a trade-off that the user can choose by itself which the best we can offer.

It add a lots of if etc around the properties but I think we can factorize it somewhere when the times come.

@alifeee
Copy link
Collaborator Author

alifeee commented Jun 14, 2023

#881 (comment)

We can add a new feature for the user to choose either:

  • get properties from API each time it requests a property
  • get the local known property to reduce API calls.

@alifeee
Copy link
Collaborator Author

alifeee commented Jun 29, 2023

Currently, _properties is updated:

  • by __init__
  • whenever a property is changed by the Worksheet object, e.g., by Worksheet.update_title

I think this issue is beyond the scope of the project. However, we could add one small method Worksheet.update_properties, or some such, so that people could use it if they wanted, before accessing properties.

Thoughts?

@alifeee alifeee modified the milestones: 6.0.0, 5.11.0 Jun 29, 2023
@alifeee
Copy link
Collaborator Author

alifeee commented Jun 29, 2023

note: one of the properties (lastUpdateTime) currently has a method for updating it. The proposed change above would add a method similar to this but to update all properties.

(from #1227)

@alifeee
Copy link
Collaborator Author

alifeee commented Aug 8, 2023

With #1255 and other issues/PRs, we are trying to remove @propertys that make API calls. Thus, this issue should 'soon' no longer be necessary.

@alifeee alifeee closed this as completed Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant