Data Synchronization part 3

In Data Synchronization Part 2 we demonstrated how easy it is to synchronize the data between different databases.

Both of the methods suggested works very well for small and medium-sized tables

For large tables, we must use a different approach. The basic idea is very simple we must work only with the relevant data.

In order to achieve that we must store and use maximum values of the primary key before and after the transformation

Example

Synchronization

Start value

The following SQL is used to get a starting point for the data reader, table PK_STATISTICS is used to store values.

Table creation script

TABLE [dbo].[PK_STATISTICS]
([TABLE_NAME] [varchar](50) NULL,
[PK_BEFORE] [int] NOT NULL,
[PK_AFTER] [int] NOT NULL
)
ON [PRIMARY]

#MAX-VALUE# is a variable name, later inside data writer variable is replaced with the actual value

Variable Name can be any combination of characters

Synchronization

More information about Working With Variables

Transformation

Does actual loading

Transformation

Reader

Reads new records from the source table using the following SQL

Variable #MAX-VALUE# is replaced with an actual value before the execution. (Use global variables to avoid syntax errors)

Reader

Transformer

Just passes values to data writer

Transformer

Writer 1

Adds records

Writer

SQL executed before the writer starts loading records

SQL

SQL executed once the writer finishes loading records

SQL

Variables

Variables

Set Flag

Updates records in source table

Set Flag

For more technologies supported by our ETL Software see Advanced ETL Processor Versions

Confused? Ask question on our ETL Forum

Posted on March 28, 2023 • 2 min read • 253 words
www.etl-tools.com About Support Pricing Cookies Policy Term Of Use Privacy Policy License