MeanPug / django-gsheets

Django app for keeping models and google sheets synced
https://www.meanpug.com/sync-data-to-and-from-google-sheets-with-django-gsheets/
MIT License
60 stars 25 forks source link

Suggestion: push a specific row only #11

Open Titorat opened 4 years ago

Titorat commented 4 years ago

Would it be of use if the library was able to push changes that happened only in specific rows? I am encountering this, as I am using celery and there are multiple rows that are being updated and processed in parallel. Each updating the sheet, so for some time the sheet might have false information. I believe enabling this will enhance the synchronization capabilities of the library.

steinbachr commented 4 years ago

@Titorat can you expand on this a bit? How would we define which rows meet "sync" criteria? Are you proposing a method that can be overridden on the subclass i.e. should_sync(row), or some other mechanism?

Titorat commented 4 years ago

@steinbachr Not completely sure, but I think something like this could be done by just modifying the function "push_to_sheet" for example ( pushing data is my specific use case, I don't yet know how to do that with pulling data instead of pushing).

So for example it could accept a list of ids in addition to the "cls" argument, which it would provide to the "get_sheet_queryset" to filter the objects by. This will not be a complete sync of course because the database could have some modifications that are not synced yet. But I think it could be useful in some use cases.