Module 09 · Lesson 6 of 9Detailed study · about 18 min

Initial sync, incremental changes and replay

Initial sync establishes a baseline. Incremental sync processes later changes. Both need a contract for identity, ordering, deletion and retry.

Understand the idea

The first sync copies the current baseline. Later runs should discover changes efficiently, but there can be a boundary between listing content and reading later changes. Use the connector’s documented state behavior instead of inventing a timestamp bookmark.

Key ideas in simple English
ConceptWhat it means
BaselineThe initial in-scope snapshot.
CheckpointA remembered source position; meaning depends on the connector.
ReplayReceiving previously processed work again.
TombstoneA retained deletion marker preventing stale resurrection.

A concrete example

The first sync copies the current baseline. Later runs should discover changes efficiently, but there can be a boundary between listing content and reading later changes. Use the connector’s documented state behavior instead of inventing a timestamp bookmark.

Remember: Keep a latest version and deletion marker so old deliveries cannot restore stale state.

Explain it step by step · full theory

Understand the idea

The first sync copies the current baseline. Later runs should discover changes efficiently, but there can be a boundary between listing content and reading later changes. Use the connector’s documented state behavior instead of inventing a timestamp bookmark.

Our teaching data uses an increasing numeric version per document. Real connectors may expose different revision tokens or timestamps; never sort opaque source tokens numerically or assume all connectors provide exactly these columns.

Apply it carefully

A retry can redeliver an event. Identical duplicates should not multiply documents. Conflicting payloads with the same source, ID and version are a contract error; quarantine and investigate them before selecting a winner.

A deleted document should stop appearing in active results. Keeping its latest deletion version lets an older replay remain older instead of recreating it. This is a destination design principle, not a claim about every connector’s internal tables.

Words used in this lesson
Baseline
The initial in-scope snapshot.
Checkpoint
A remembered source position; meaning depends on the connector.
Replay
Receiving previously processed work again.
Tombstone
A retained deletion marker preventing stale resurrection.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 2

Initial sync, incremental changes and replay

Initial snapshot
Incremental changes + replay
Versioned destination state

Follow the flow

Initial sync establishes a baseline. Incremental sync processes later changes. Both need a contract for identity, ordering, deletion and retry.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Follow the flow

    Initial sync establishes a baseline. Incremental sync processes later changes. Both need a contract for identity, ordering, deletion and retry.

  2. Find the boundary

    A deleted document should stop appearing in active results. Keeping its latest deletion version lets an older replay remain older instead of recreating it. This is a destination design principle, not a claim about every connector’s internal tables.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

SQL practice is manual. The website does not connect to external services. Connector deployment is a separate administrator-assisted exercise.

Hands-on SQL: Initial sync, incremental changes and replay

SQL · example
INSERT INTO DOCUMENT_EVENTS VALUES
 ('SHAREPOINT','policy-1',2,'Travel policy revised','UPSERT','FINANCE','2026-01-01 10:00:00','2026-01-01 10:02:00'),
 ('SHAREPOINT','policy-1',2,'Travel policy revised','UPSERT','FINANCE','2026-01-01 10:00:00','2026-01-01 10:02:00'),
 ('SHAREPOINT','guide-1',2,'Team guide','DELETE','STAFF','2026-01-01 10:01:00','2026-01-01 10:03:00');
SELECT SOURCE_SYSTEM,DOCUMENT_ID,SOURCE_VERSION,COUNT(*) AS DELIVERIES
FROM DOCUMENT_EVENTS GROUP BY 1,2,3 HAVING COUNT(*)>1;

What to expect and why

One duplicate group: SHAREPOINT/policy-1/version 2 with two deliveries. There are now six event rows, representing three document identities.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Should a replay of version 1 undo a version 2 deletion?

Try it yourself

Explain your decision: Should a replay of version 1 undo a version 2 deletion?

Compare your reasoning

Keep a latest version and deletion marker so old deliveries cannot restore stale state.

Official sources and curriculum

Module 09 · See module scope