Sync Rules

PowerSync Sync Rules allow developers to control which data gets synchronized to which devices (i.e. they enable dynamic partial replication).

Defining Sync Rules

Each PowerSync service instance has a sync rules configuration where sync rules are defined using SQL queries combined together in a YAML file.

The PowerSync service will use these SQL queries to group data into "sync buckets" when replicating data to client devices.

Functionality includes:

  • 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.

Replication Into Sync Buckets

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 service. Data is incrementally updated so that sync buckets always contain current state data as well as a full history of changes.

Client Database Hydration

PowerSync asynchronously hydrates local databases embedded in the PowerSync SDK based on data in sync buckets.

Last updated