<@U04S8PLJWMT> can you help me understand implicat...
# ask-ai
k
@kapa.ai can you help me understand implications / is a full resync needed if i changed streams in a connection from "incremental + append" to "incremental + append deduped" ? Context is we only run one sync in incremental + append so we'd assume jthe state would be identical if we switched the mode. Also what is the recommendation when to use these 2 modes ?
k
Switching a stream from "Incremental + Append" to "Incremental + Append + Deduped" in Airbyte has some important implications: ### 1. Is a Full Resync Needed? If you have only run one sync in "Incremental + Append" mode, and then switch to "Incremental + Append + Deduped," the state of your data should be effectively identical after the first deduped sync. This is because: - "Incremental + Append" simply appends all new or updated records, so after one sync, you have a single version of each record. - "Incremental + Append + Deduped" will deduplicate based on the primary key and cursor, but with only one version of each record, deduplication will not remove any data. Therefore, a full resync is not strictly required in this scenario. However, if you had run multiple syncs in "Incremental + Append" mode, you would have multiple versions of updated records, and switching to "Incremental + Append + Deduped" would then deduplicate these, keeping only the latest version per primary key in the final table. No data would be lost, but the final table would now only show the latest state per record, while the history table would retain all versions. If you want to ensure a clean deduped state, you may optionally perform a full resync, but it is not mandatory after just one sync [source](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped). ### 2. When to Use Each Mode - Incremental + Append: Use this mode if you want to keep a full history of every change to every record. Each update or insert in the source results in a new row in the destination, even for the same primary key. This is useful for audit trails or slowly changing dimension (SCD) use cases where you want to track every version of a record. However, your destination tables will grow quickly and may contain many duplicates for the same primary key [source](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append). - Incremental + Append + Deduped: Use this mode if you only want the latest version of each record in your final table, deduplicated by primary key. This is more efficient for most analytics use cases where you care about the current state of your data, not its full history. Airbyte will still keep a history table with all versions, but the main table will only have the latest version per primary key [source](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped). Summary Table: | Mode | Keeps History? | Final Table State | Use Case | |-----------------------------|---------------|--------------------------|----------------------------------| | Incremental + Append | Yes | All versions (duplicates)| Audit, SCD, full change history | | Incremental + Append Deduped| Yes (history) | Latest per primary key | Analytics, current state | Recommendation: - Use Incremental + Append if you need every version of every record. - Use Incremental + Append + Deduped if you only need the latest version per record in your main table, but still want to retain history for reference or compliance. If you switch modes after only one sync, a full resync is not required, but if you want to ensure a clean deduped state (especially after multiple syncs), a full resync can be considered for consistency [source](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped).
k
@kapa.ai gotcha. in the case of multiple syncs done is it possible to "migrate" the connection then ? Say we have 4 syncs done for a hubspot <> snowflake connector with incremental + append mode for a pilot. After analysis we decided that append deduped is the way. Can we effectively do the following 1. go to snowflake console, clone the destination tables into a backup schema, 2. On the current schema, run SQL to manually dedupe the tables keeping latest records only 3. On the airbyte cloud portal, swap the connection sync mode to append + deduped Reason being we want to minimize costs when swapping config
k
A message from kapa.ai
New message text here
k
@kapa.ai can you check if there's any implications to the RAW table if we migrated this way ?
k
A message from kapa.ai
If you migrate from "Incremental + Append" to "Incremental + Append + Deduped" by manually deduping the final tables in your destination, the RAW tables in your destination will not be affected by this process. Airbyte's RAW tables are designed to store every record that is extracted from the source, including all versions of updated records, and are not deduplicated or cleaned up automatically—even after switching sync modes or deduping the final tables manually. Key implications for RAW tables: - RAW tables will continue to accumulate all records (including duplicates and historical versions) as they did before. Manual deduplication of the final table does not impact the RAW tables. - Switching sync modes does not retroactively deduplicate or clean up the RAW tables. They will still contain all previously synced records, including any duplicates from prior "Incremental + Append" syncs. - RAW tables can grow large and contain significant duplication, especially if your source data changes frequently. This is a known behavior and can lead to increased storage costs, as noted in user reports and documentation. There is currently no built-in Airbyte feature to automatically consolidate or truncate RAW tables after switching sync modes or deduping the final table [Excessive duplication in airbyte_internal raw tables](https://github.com/airbytehq/airbyte/issues/62501). If you are concerned about storage costs or RAW table size, you may need to manage RAW table cleanup manually in your destination warehouse. However, be aware that Airbyte does not guarantee the stability of RAW tables for downstream use, and they are intended primarily as a staging area for sync operations [Upgrading as a User of Raw Tables](https://docs.airbyte.com/release_notes/upgrading_to_destinations_v2#upgrading-as-a-user-of-raw-tables). Summary: Migrating in this way will not affect the RAW tables—they will retain all historical data, including duplicates. Only the final (deduped) tables will reflect your manual deduplication and the new sync mode going forward.
k
@kapa.ai let's dive deeper in the append+dedupe mechanism what are the exact steps that airbyte will perform on a sync ? I am assuming that after loading to destination, airbyte will perform a merge query on the destination (not the RAW table) to keep only latest records. If that is the case then in my plan to switch from
incremental + append
to
incremental + append deduped
won't need to manually dedupe the destination table through snowflake console at all airbyte will handle it.
k
A message from kapa.ai
You're correct in your understanding: when you switch a stream to Incremental + Append + Deduped mode, Airbyte will handle the deduplication of the final table for you—**you do not need to manually dedupe the destination table**. ### How does Incremental + Append + Deduped work? Here are the exact steps Airbyte performs during a sync in this mode: 1. Extract new or updated records from the source since the last sync, using the cursor field (e.g.,
updated_at
). 2. Append these records to the RAW table in the destination. The RAW table accumulates all records, including duplicates and historical versions. 3. Append the new records to the history (SCD) table in the destination, maintaining a full versioned history. 4. Deduplicate into the final table: - Airbyte uses the primary key and cursor field to identify the latest version of each record. - The final table is updated so that only the most recent version of each record (per primary key) is present. - This deduplication is typically performed using SQL operations such as
MERGE
or similar, depending on the destination. For example, in Snowflake, Airbyte can use a
MERGE
statement to update or insert records as needed, ensuring only the latest version remains in the final table [Incremental Sync - Append + Deduped](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped), [Rules](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped#rules), [Snowflake Merge Discussion](https://github.com/airbytehq/airbyte/discussions/47219). ### Implications for Migration - If you switch from "Incremental + Append" to "Incremental + Append + Deduped" after several syncs, Airbyte will deduplicate the final table on the next sync, keeping only the latest record per primary key. - **Manual deduplication is not required**—Airbyte will handle it as part of the sync process. - The RAW and history tables will still contain all historical versions, but the final table will be deduped automatically. In summary: You do not need to manually dedupe the destination table when switching to "Incremental + Append + Deduped." Airbyte will perform the deduplication for you during the sync, using the primary key and cursor to ensure only the latest records are present in the final table [Incremental Sync - Append + Deduped](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped).
k
@kapa.ai can you help understand the role of RAW table if it has implications for this case. 1. We started with incremental append on 08/01 daily sync 2. Ran 5 days until 08/05 then we switched to append+dedupe mode. We created a snapshot of the tabes to another schema and note down the connection state. 3. After 10 days 08/15 we identified some streams in the connection i.e. stream a b c we want to swap to append mode instead of append deduped. a. We create a separate connection for those streams b. Point the destination to the snapshotted tables in 08/15 c. Configure the connection state captured at step (2) d. Enable the sync so it picks up appending from the state I'd assume for stream a b c both connections are going to point to the same 3 RAW tables thus would need further mitigation ?
k
A message from kapa.ai
Based on the available Airbyte documentation, here’s what can be said about the role and implications of the RAW table in your scenario: ### Role of the RAW Table - The RAW table in Airbyte acts as a staging area where all records extracted from the source are stored, including all versions of updated records. This table is not deduplicated and will accumulate every record sent from the source, regardless of the sync mode used (Incremental + Append or Incremental + Append Deduped) [source](https://airbyte.com/tutorials/incremental-data-synchronization#step-7), [source](https://docs.airbyte.com/platform/using-airbyte/core-concepts/direct-load-tables#what-will-change). ### Implications for Your Scenario 1. Switching Sync Modes and RAW Table Content - When you switch from Incremental + Append to Incremental + Append Deduped, the RAW table continues to accumulate all records, including duplicates and historical versions. The deduplication only affects the final table, not the RAW table [source](https://airbyte.com/tutorials/incremental-data-synchronization#step-7). 2. Creating a New Connection Pointing to the Same RAW Table - If you create a new connection for streams a, b, c and point the destination to the snapshotted tables, both the old and new connections will, by default, write to their own RAW tables (unless you explicitly configure them to share the same schema and table names). - However, Airbyte’s RAW tables are intended as internal staging and are not designed for sharing or direct downstream use. The documentation warns that the stability and structure of RAW tables are not guaranteed, and they may change between Airbyte versions [source](https://docs.airbyte.com/release_notes/upgrading_to_destinations_v2#upgrading-as-a-user-of-raw-tables). 3. Potential Issues - If both connections are configured to write to the same RAW tables (i.e., same schema and table names), you could encounter data consistency issues, as both connections may append data independently, leading to possible duplication or confusion in downstream processing. - There is no built-in Airbyte mechanism to coordinate or deduplicate RAW table writes across multiple connections. The RAW table will simply accumulate whatever each connection writes to it. 4. Mitigation - The recommended approach is to avoid relying on RAW tables for downstream processes or for sharing between connections. Instead, use the final (deduped or append) tables produced by Airbyte, which are managed according to the sync mode logic. - If you must share RAW tables, you will need to implement your own mitigation strategies (such as custom deduplication or partitioning), but this is not recommended or supported by Airbyte documentation. ### Summary - RAW tables will accumulate all records from all syncs, regardless of mode. - Switching sync modes or creating new connections does not clean up or deduplicate RAW tables. - Pointing multiple connections to the same RAW tables is not recommended and may require manual mitigation. - Best practice is to use Airbyte’s managed final tables for analytics and downstream use, not the RAW tables [source](https://docs.airbyte.com/release_notes/upgrading_to_destinations_v2#upgrading-as-a-user-of-raw-tables). If you need further control or cleanup of RAW tables, you will need to handle this outside of Airbyte, as the platform does not provide built-in features for this scenario.