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

DataStore. Disable sync for model in SyncExpressions #13264

Open
1 of 2 tasks
kolodi opened this issue Apr 18, 2024 · 1 comment
Open
1 of 2 tasks

DataStore. Disable sync for model in SyncExpressions #13264

kolodi opened this issue Apr 18, 2024 · 1 comment
Assignees
Labels
DataStore Related to DataStore category pending-triage Issue is pending triage

Comments

@kolodi
Copy link

kolodi commented Apr 18, 2024

Is this related to a new or existing framework?

No response

Is this related to a new or existing API?

DataStore

Is this related to another service?

No response

Describe the feature you'd like to request

Make it possible to completely disable model sync

Describe the solution you'd like

syncExpression function returns filtering predicate or Predicates.ALL . Ideally, there can a new kind of return, like PredicateNONE for example, which should result in removing target model from the sync process.

Describe alternatives you've considered

I've tried to return predicates with empty PKs or Indexes like so:

(a) => a.id.eq("")
(a) => a.someIndexField.eq("")

In both cases there are still request being made and I can actually see DynamoDB scan requests! (this is really bad)
Slightly better is just to add inexidting index lookup

(a) => a.someIndexField.eq("I DO NOT EXIST")

At least this one result in a Query not Scan, but still useless

Overriding resolvers to avoid DB calls completely would be slightly better but I don't event try this as it is tedious and you still ends up with unnecessary network requests

Additional context

My application has 7 models, but I want to sync only 4 of them, and even then, some users may have access to only 1 or 2 (often GSI queries are used). Yet, DataStore makes all those useless and certainly expensive network and DB requests for all users even if they need like 0.001% of the data.

I already have looked in source code and tried to implement selective model sync, yet I did not manage to link changes to my sample project to test it.

There is an old related issue for this opened: #10062

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@kolodi kolodi added the pending-triage Issue is pending triage label Apr 18, 2024
@cwomack cwomack added the DataStore Related to DataStore category label Apr 18, 2024
@kolodi
Copy link
Author

kolodi commented May 10, 2024

When disabling all operations on the model as described here or by excluding just sync, will it exclude this particular model from DataStore syncing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataStore Related to DataStore category pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

3 participants