Sync rules allow developers to control which data gets synchronized to which devices.
Each PowerSync instance has a sync rules configuration where sync rules are defined using SQL queries and combined together in a YAML file.
The cloud service will use these SQL queries to group data into "sync buckets" when replicating data to client devices.
Sync rules are configured per PowerSync instance.
- Selecting tables and columns to sync.
- Filtering data according to user ID.
- Filter data with static conditions.
- Filter data with custom parameters.
- Transforming column values.
PowerSync replicates and transforms relevant data from the source database according to sync rules.
Data from this step is persisted in separate sync buckets on the PowerSync cloud service. Data is incrementally updated so that sync buckets always contain current state data as well as a full history of changes.
Diagram showing how data is replicated from the source database into sync buckets.
PowerSync asynchronously hydrates local databases embedded in the PowerSync SDK based on data in sync buckets.
Data flow showing sync buckets which are created based on sync rules.