forRowsWithMatchingids
By default, the JSON payload returned from the REST call replaces all existing data in the SQLite database. However, the forRowsWithMatchingIds property controls how data from REST API responses is synchronized with the local SQLite database.
This approach is useful for incrementally syncing data without affecting unrelated records, making it ideal for scenarios where partial updates or record-level inserts are required.
Understanding data sync behavior
The behavior of data synchronization depends on whether forRowsWithMatchingIds and explicit operations are specified. When using explicit operations, you lose the automatic upsert-merge behavior provided with the forRowsWithMatchingIds and must define all desired operations yourself. The id field in your outputTransform is critical for matching records.
There are three scenarios:
Scenario 1 (Default)
No forRowsWithMatchingIds + no operations
Wipe and sync
Scenario 2 (Automatic)
forRowsWithMatchingIds: true + no operations
Automatic upsert-merge
Scenario 3 (Manual)
forRowsWithMatchingIds + explicit operations
You control the behavior
Considerations
Always ensure your
outputTransformincludes anidfield when usingforRowsWithMatchingIds.When using explicit
operations(Scenario 3), carefully plan your operation sequence.Test your synchronization logic thoroughly, especially when handling deletions.
Last updated
Was this helpful?