Write a data diff function that can generate difference data for two datasets, source and target. The goal is to allow intelligent one-way synchronization between these two datasets using database CRUD operations. There are two assumptions about source and target:
Columns of source are a subset of the columns of target.
Though both source and target share their primary key, target adds a primary key that is different from the primary key in source.
Here is an example that illustrates the problem and provides some prototype code:
Data synchronization functions could use the output of this function as the primary input for CRUD operations against a database table, with the contents of target that need to reflect the data in source.
Which rows get written and what additional columns might accompany the source data are implementation dependent and outside the scope of this function.
Write a data diff function that can generate difference data for two datasets,
source
andtarget
. The goal is to allow intelligent one-way synchronization between these two datasets using database CRUD operations. There are two assumptions aboutsource
andtarget
:source
are a subset of the columns oftarget
.source
andtarget
share their primary key,target
adds a primary key that is different from the primary key insource
.Here is an example that illustrates the problem and provides some prototype code:
Data synchronization functions could use the output of this function as the primary input for CRUD operations against a database table, with the contents of
target
that need to reflect the data insource
.Which rows get written and what additional columns might accompany the source data are implementation dependent and outside the scope of this function.