Skip to content

DataStore. Disable sync for model in SyncExpressions #13264

@kolodi

Description

@kolodi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DataStoreRelated to DataStore categoryfeature-requestRequest a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions