<@U04S8PLJWMT> could you please explain me how the...
# replication-ask-ai
l
@kapa.ai could you please explain me how the icremental load is working in source(csv) and target(postgres) . how the new records is inserting instead of all.
k
How Incremental Sync Works (CSV Source → Postgres Destination) The knowledge sources don't specifically cover a CSV source connector, but the core incremental sync mechanics apply generally across Airbyte sources. Here's how it works: The Core Concept Instead of copying all records on every sync, incremental sync only replicates records that are new or modified since the last sync. [Incremental Append Docs] How New Records Are Identified: The Cursor The key mechanism is a cursor field — a column in your data (commonly
updated_at
or an auto-incrementing
id
) that tracks which records have already been synced. [Incremental Append Docs] Here's the flow: 1. First sync — All records are treated as new and replicated to Postgres (behaves like a full refresh). 2. Airbyte stores the cursor value — It saves the maximum cursor value (e.g., the latest
updated_at
timestamp) from that sync. 3. Subsequent syncs — Airbyte queries the source using a condition like
WHERE cursor_field >= last_cursor_value
, so only new or updated records are fetched and appended to Postgres. [Incremental Sync Tutorial] Two Incremental Sync Modes [Incremental Append + Deduped] Requirements for Incremental Sync to Work For incremental sync to work correctly, your CSV data needs: [Connector Builder Incremental Sync] • A cursor field (e.g.,
updated_at
,
created_at
, or an incrementing
id
) at the top level of each record. • The cursor field values must be monotonically increasing (always growing over time). • Records with NULL cursor values will be excluded from incremental syncs. > ⚠️ Note: The knowledge sources do not contain specific details about the CSV source connector's incremental sync support. Some source connectors may have limitations — I'd recommend checking the Airbyte CSV source connector documentation directly to confirm it supports incremental sync and which cursor fields are available. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help., with interactive elements
l
@kapa.ai where the data is storing . like the last updated cursor value. last id to identify the new records
k
Where the Cursor State is Stored Airbyte stores the cursor value (last synced state) in its internal Postgres database. [Incremental Sync Tutorial] The state Table The cursor value is persisted in a table called
state
inside Airbyte's internal database. You can inspect it by running:
Copy code
docker exec -ti airbyte-db psql -U docker -d airbyte
Then query the state table:
Copy code
SELECT * FROM state;
Which returns something like:
Copy code
id | connection_id | state | created_at | updated_at | stream_name | namespace | type
...
{"state": {"cdc": false, "streams": [{"cursor": "2022-09-02T07:55:58.324989", 
"stream_name": "table_one", "cursor_field": ["updated_at"], "stream_namespace": "public"}]}}
[Incremental Sync Tutorial] Key Columns in the state Table [State Table Docs] How It's Used • After each sync, Airbyte saves the maximum cursor value seen in that sync to this table. • On the next sync, Airbyte reads this stored value and uses it to fetch only records newer than that cursor. [Airbyte Protocol Docs] • If a sync fails mid-way, the last successfully checkpointed cursor value is used, so the next sync picks up from that point rather than starting over. [Airbyte Protocol Docs] Viewing/Editing State via UI You can also view and edit the connection state directly in the Airbyte UI: 1. Go to Connections → select your connection 2. Click the Settings tab 3. Expand the Advanced dropdown The Connection State will be displayed there. [Manage Connection State] > ⚠️ Editing the state should be done with care, as incorrect changes can break your syncs and may require a full historical resync to fix. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help., with interactive elements