<@U04S8PLJWMT> Does the airbyte iceberg connector ...
# ask-ai
w
@kapa.ai Does the airbyte iceberg connector do append only or does it perform merge operations? The idea would be to read from a postgres CDC source
k
The Airbyte S3 Data Lake connector, which supports Apache Iceberg tables, does not do append-only writes by default. Instead, it uses a "merge-on-read" strategy to support deduplication and upsert-like operations. Specifically, Airbyte translates the stream's primary keys to Iceberg's identifier columns and performs an "upsert" as an equality-based delete on the row's primary key, followed by an insertion of the new data. This means that the connector can merge records based on primary keys, not just append them, which is particularly useful when reading from a Postgres CDC source where updates and deletes need to be reflected in the destination table. However, for this deduplication and upsert behavior to work correctly, the source (in this case, Postgres CDC) must emit records in cursor order from oldest to newest, and not emit the same primary key multiple times in a single sync unless this order is preserved. If these conditions are not met, you may see inaccurate data, and in such cases, you can fall back to append or overwrite sync modes instead of deduplication/merge-on-read modes. More details can be found in the [S3 Data Lake connector documentation](https://docs.airbyte.com/integrations/destinations/s3-data-lake#deduplication). So, to summarize: the Airbyte Iceberg connector does perform merge operations (not just append-only) when configured for deduplication/upsert, which is compatible with a Postgres CDC source if the above conditions are met.
w
@kapa.ai Doesnt change data capture ensure a log that is in cursor order anyways? Like would there be a way for postgres to have an out of order WAL log?
k
A message from kapa.ai
Change Data Capture (CDC) in Airbyte for Postgres works by reading the write-ahead log (WAL) using logical replication. The WAL itself is an ordered log of all changes (inserts, updates, deletes) made to the database. When Airbyte (via Debezium) reads from the WAL, it processes changes in the order they were committed to the database, which is effectively "cursor order"—from oldest to newest changes. This ensures that the stream of changes is ordered and consistent with the sequence of operations in the source database. There is no indication in the provided knowledge sources that Postgres would emit out-of-order changes in its WAL. The WAL is designed to be a sequential log, and logical decoding (used for CDC) reads it in order. Therefore, when using CDC with Postgres, you can expect the changes to be in the correct order for downstream processing, such as merge operations in Iceberg tables. For more details on how Airbyte uses CDC and WAL for Postgres, see [Explore Airbyte's Change Data Capture (CDC) synchronization](https://airbyte.com/tutorials/incremental-change-data-capture-cdc-replication) and [Build an EL(T) from Postgres CDC (Change Data Capture)](https://airbyte.com/tutorials/postgresql-change-data-capture-elt#step-9).
w
@kapa.ai does the s3 data lake connector handle deleted records from the CDC log?
k
A message from kapa.ai
I'm sorry, but the provided knowledge sources do not contain explicit information about whether the Airbyte S3 Data Lake connector (with Iceberg) specifically handles deleted records from the CDC log. The sources discuss how CDC works in general, including how deletions are represented in the log (with fields like
_ab_cdc_deleted_at
), and how some destinations handle deletions, but there is no direct mention of the S3 Data Lake connector's behavior regarding deletes from a CDC source. If you need a definitive answer, I recommend consulting the official Airbyte documentation for the S3 Data Lake connector or reaching out to the Airbyte community for clarification.
w
@kapa.ai If i had time based such that the real primary key of a table is an identifier plus a date column, do i need to create postgres composite primary keys such that Airbyte will recognize the PK?
k
A message from kapa.ai
No, you do not need to create a composite primary key in Postgres itself for Airbyte to recognize the primary key. Airbyte allows you to define the primary key at the stream level during connector configuration, even if the source table does not have a composite primary key defined in the database. You can select multiple fields (such as an identifier and a date column) to form a composite primary key within Airbyte. This user-defined primary key will be used for deduplication and merge operations in sync modes like Incremental | Append + Deduped [User-Defined Primary key](https://docs.airbyte.com/platform/next/using-airbyte/core-concepts/sync-modes/incremental-append-deduped#user-defined-primary-key). So, as long as you specify the correct fields (identifier + date) as the primary key in your Airbyte stream configuration, Airbyte will use them for deduplication, regardless of whether they are defined as a composite primary key in Postgres.
w
@kapa.ai what does Self-Managed Community mean for an airbyte connector?
k
A message from kapa.ai
In Airbyte, "Self-Managed Community" refers to the open-source version of Airbyte that you can deploy and manage on your own infrastructure. When a connector is available for "Self-Managed Community," it means you can use that connector in your self-hosted, open-source Airbyte deployment without requiring an enterprise license or using Airbyte Cloud. This version is designed for users who want to keep their data on-premises and manage everything themselves. Support for Self-Managed Community connectors is community-based, typically via Slack or GitHub Discussions, and does not include official SLAs or enterprise-level support. Some connectors or features may only be available in Enterprise or Cloud versions, but most connectors are available in the Community edition as well [Getting Support](https://docs.airbyte.com/platform/community/getting-support) [Airbyte platform](https://docs.airbyte.com/platform). In summary, "Self-Managed Community" means you can use and manage the connector in your own open-source Airbyte deployment, with support provided by the community rather than Airbyte’s enterprise support team.
w
@kapa.ai Does a CDC postgres source still need to be scheduled or does it stream live changes?
k
A message from kapa.ai
A CDC Postgres source in Airbyte does not stream live changes in real time; it still requires scheduling. Airbyte does not treat CDC sources as infinite streaming sources. Instead, you must set a sync interval, and Airbyte will read changes from the WAL (write-ahead log) up to the start time of each scheduled sync. The syncs are launched regularly based on the schedule you configure. This means changes are captured and replicated in near real-time, but not continuously streamed as they happen [Understanding CDC](https://docs.airbyte.com/platform/understanding-airbyte/cdc) [CDC synchronization tutorial](https://airbyte.com/tutorials/incremental-change-data-capture-cdc-replication). So, you need to schedule your CDC syncs frequently enough to keep up with the volume of changes in your source database.
w
@kapa.ai I am only seeing full refresh options in the connection. This appears to load the entire postgres dataset each time into s3. Does CDC not only capture changes?
k
A message from kapa.ai
If you are only seeing full refresh options in your Airbyte connection and the entire Postgres dataset is being loaded into S3 each time, it suggests that incremental sync (including CDC-based incremental) is not enabled or not available for your setup. CDC (Change Data Capture) is designed to capture and replicate only the changes (inserts, updates, deletes) since the last sync, rather than reloading the entire dataset. However, for CDC-based incremental sync to be available, both the source (Postgres) and the destination (S3 Data Lake) connectors must support incremental sync modes. If you only see full refresh options, it could be due to one of the following reasons: - The source or destination connector does not support incremental sync for the selected stream. - The table may not have a primary key, which is required for CDC incremental replication in most cases. - CDC may not be properly configured or enabled on the Postgres source. - There may be a misconfiguration in the Airbyte connection setup. You can verify CDC support and configuration by reviewing the connection and stream settings. If CDC is enabled and supported, you should see incremental sync options (such as "Incremental | Append" or "Incremental | Append Deduped") in addition to full refresh options. If not, only full refresh will be available, and the entire dataset will be loaded each time [Sync Modes](https://docs.airbyte.com/platform/1.7/using-airbyte/core-concepts/sync-modes) [CDC Limitations](https://docs.airbyte.com/platform/1.7/understanding-airbyte/cdc#limitations). In summary: CDC does capture only changes, but if you only see full refresh options, incremental sync (including CDC) is not currently enabled or supported for your connection as configured.
w
@kapa.ai I want to use CDC to stream changes from postgres into S3 Data Lake. What would be the desired sync type to meet my objective and is it available with these sources/destinations?
k
A message from kapa.ai
To stream changes from Postgres into S3 Data Lake using CDC in Airbyte, the desired sync type is Incremental | Append or Incremental | Append Deduped. These sync modes allow Airbyte to capture only the changes (inserts, updates, deletes) since the last sync, rather than performing a full refresh each time. With CDC enabled, Airbyte reads changes from the Postgres write-ahead log (WAL) and applies them to the destination, which is ideal for your use case of streaming changes into S3 Data Lake [Sync Modes](https://docs.airbyte.com/platform/1.7/using-airbyte/core-concepts/sync-modes) [CDC Overview](https://docs.airbyte.com/platform/1.7/understanding-airbyte/cdc). Availability with Postgres CDC Source and S3 Data Lake Destination: - The knowledge sources confirm that Postgres as a source supports CDC and incremental sync modes [CDC Limitations](https://docs.airbyte.com/platform/1.6/understanding-airbyte/cdc). - The S3 Data Lake destination supports deduplication and upsert-like operations, which are compatible with incremental sync modes when the source emits records in order [S3 Data Lake Deduplication](https://docs.airbyte.com/integrations/destinations/s3-data-lake#deduplication). Important: If you are only seeing full refresh options, it may indicate a configuration issue, missing primary keys, or a limitation in the connector version you are using. Both the source and destination must support incremental sync for these options to appear. Ensure that: - CDC is properly configured and enabled on your Postgres source. - The tables have primary keys. - You are using compatible versions of the connectors. Summary: To meet your objective, use Incremental | Append or Incremental | Append Deduped sync mode with CDC enabled. This is supported by Postgres CDC sources and S3 Data Lake destinations, provided all requirements are met. If you do not see these options, review your configuration and connector compatibility.
w
@kapa.ai Does the primary key need to physically be implemented in the database? Or does it simply require a unique column?
k
A message from kapa.ai
For CDC incremental sync in Airbyte, the primary key must be physically implemented in the database for most sources, including Postgres. The documentation and tutorials consistently state that CDC incremental replication is only supported for tables with primary keys, and examples show the primary key being explicitly defined in the table schema. There is no indication in the knowledge sources that simply having a unique column (without a primary key constraint) is sufficient for CDC to work with Postgres sources [Explore Airbyte's Change Data Capture (CDC) synchronization](https://airbyte.com/tutorials/incremental-change-data-capture-cdc-replication) [CDC Limitations](https://docs.airbyte.com/platform/understanding-airbyte/cdc#limitations). In summary: Yes, the primary key must be physically implemented in the database for CDC incremental sync to work with Postgres in Airbyte.
w
@kapa.ai I have added a primary key constraint. I am still not seeing an option for incremetnal sync. What could be the issue? Please be specific and walk me through potential trouble shooting
k
A message from kapa.ai
If you have added a primary key constraint to your Postgres table but still do not see the option for incremental sync in Airbyte, here are specific troubleshooting steps based on the knowledge sources: --- ### 1. Check for a Valid Cursor Field - For incremental sync (non-CDC), Airbyte requires a valid cursor field (such as a timestamp or incrementing ID). If no suitable column is detected, incremental sync will not be available, even if a primary key exists. Nullable columns were previously not allowed as cursors, but recent versions support them. Make sure your Airbyte version and connector are up to date if you are using a nullable column as a cursor [Forum Post: Postgres source tables have no incremental option](https://discuss.airbyte.io/t/2694). ### 2. CDC-Specific Requirements - For CDC-based incremental sync, ensure: - CDC is enabled and properly configured on your Postgres source (logical replication, replication slot, publication, and correct permissions) [CDC Setup](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#setup-using-cdc). - The table is not a view (CDC only works with tables, not views) [CDC Limitations](https://docs.airbyte.com/platform/understanding-airbyte/cdc#limitations). - You are using a supported version of Airbyte and the Postgres connector (Postgres v10+ for CDC, Airbyte v0.58.0+ recommended) [Postgres Troubleshooting](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#connector-limitations). ### 3. Schema Refresh - After adding a primary key, you may need to refresh the source schema in Airbyte so it recognizes the new constraint. In the Airbyte UI, go to your connection, and click "Refresh source schema" [CDC Limitations](https://docs.airbyte.com/platform/1.7/understanding-airbyte/cdc#limitations). ### 4. Connector Version - Some older versions of the Postgres source connector had issues detecting primary keys or cursor fields, especially with nullable columns. Upgrading to the latest connector version can resolve this [Forum Post: Postgres source tables have no incremental option](https://discuss.airbyte.io/t/2694). ### 5. Table Structure - Ensure the table is not missing any other requirements (e.g., not a view, not missing required permissions, etc.) [CDC Limitations](https://docs.airbyte.com/platform/understanding-airbyte/cdc#limitations). ### 6. Check Logs - Review Airbyte logs for errors or warnings related to schema detection, primary key recognition, or CDC setup. Logs can provide clues if Airbyte is unable to detect the primary key or cursor field. --- Summary of Steps: 1. Ensure a valid cursor field exists (for non-CDC incremental). 2. Confirm CDC is fully configured and enabled (for CDC incremental). 3. Refresh the source schema in Airbyte after schema changes. 4. Upgrade to the latest Airbyte and connector versions. 5. Double-check table structure and permissions. 6. Review Airbyte logs for detailed error messages. If you follow these steps and still do not see the incremental sync option, there may be a connector-specific or version-specific issue. In that case, providing logs and connector versions to the Airbyte community or support channels can help diagnose the problem further.
w
@kapa.ai Walk me through the logistics of maintaining a postgres CDC source that may have new tables, new columns, and removed tables over time. Can you express the difficulty and approach to accomplishing these events, and known issues surrounding them. I am specifically concerned with the publication potentially needing to be dropped and recreated for each new table added and whether this would cause negative effects to the airbyte sync. Would I be better setting up a publication per postgres CDC source?
k
A message from kapa.ai
Maintaining a Postgres CDC source in Airbyte when your schema evolves (new tables, new columns, removed tables) involves several logistical considerations and known challenges: --- ### Adding New Tables - Publication Update Required: When you add a new table, you must add it to the Postgres publication. This does not require dropping and recreating the publication; you can use
ALTER PUBLICATION ... ADD TABLE ...
to include the new table without disrupting existing replication [Cloud SQL for PostgreSQL: Step 5](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#step-5-create-publication-and-replication-identities-for-each-postgres-table). - Airbyte Schema Refresh: In Airbyte, you must refresh the source schema to detect the new table. This triggers a snapshot (full refresh) for the new table, but does not reset existing tables [Postgres Troubleshooting: Connector Limitations](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#connector-limitations). - Known Issue: Airbyte requires a schema refresh and approval for new tables. If you skip this, the new table will not be tracked by CDC. There is no need to drop and recreate the publication for each new table, and doing so could disrupt ongoing replication. --- ### Adding New Columns - No Publication Change Needed: Adding columns does not require changes to the publication. - Airbyte Schema Refresh: You must refresh the schema in Airbyte and approve the new columns. This ensures a snapshot is taken for the new columns before CDC resumes [CDC Limitations](https://docs.airbyte.com/platform/1.7/understanding-airbyte/cdc#limitations). - Known Issue: If you do not refresh and approve schema changes, new columns will not be included in the sync. Airbyte does not automatically propagate schema changes for CDC sources. --- ### Removing Tables - Publication Update Required: You can remove tables from the publication using
ALTER PUBLICATION ... DROP TABLE ...
. - Airbyte Schema Refresh: Refresh the schema in Airbyte and deselect the removed table from the sync. - Known Issue: If you remove a table from the publication but do not update Airbyte, syncs may fail or produce errors. --- ### Dropping and Recreating Publications - Not Recommended: Dropping and recreating a publication is disruptive. It can break the replication slot and cause Airbyte to lose its CDC position, potentially requiring a full resync of all tables. Use
ALTER PUBLICATION
to add or remove tables instead [Cloud SQL for PostgreSQL: Step 5](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#step-5-create-publication-and-replication-identities-for-each-postgres-table). --- ### One Publication per CDC Source? - Single Publication Preferred: The documentation and best practices suggest using a single publication per Airbyte CDC source, including all tables you want to replicate. This simplifies management and avoids the complexity of tracking multiple publications [Cloud SQL for PostgreSQL: Step 5](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#step-5-create-publication-and-replication-identities-for-each-postgres-table). - Known Issue: If you use multiple publications, you must manage them carefully to ensure all relevant tables are included and avoid sync inconsistencies. --- ### Summary of Difficulties and Known Issues - Manual Schema Refresh: Airbyte does not automatically detect or propagate schema changes for CDC sources. You must manually refresh and approve schema changes in the UI [CDC Limitations](https://docs.airbyte.com/platform/1.7/understanding-airbyte/cdc#limitations). - Initial Snapshot for New Tables/Columns: New tables/columns require a full snapshot before CDC resumes, which can be time-consuming for large tables. - Disruption from Dropping Publications: Dropping and recreating publications can disrupt CDC and require a full resync. - No Automatic Handling of Removed Tables: You must manually update both the publication and Airbyte configuration when removing tables. --- In conclusion: You should use a single publication per CDC source and update it with
ALTER PUBLICATION
as your schema evolves. Always refresh the schema in Airbyte and approve changes to ensure CDC continues smoothly. Avoid dropping and recreating publications, as this can disrupt your syncs and require full resyncs. These steps will minimize disruption and keep your CDC pipeline healthy [Cloud SQL for PostgreSQL: Step 5](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#step-5-create-publication-and-replication-identities-for-each-postgres-table) [CDC Limitations](https://docs.airbyte.com/platform/1.7/understanding-airbyte/cdc#limitations).
w
@kapa.ai So to confirm, a new column requires approving the schema change in airbyte and then will resync the entire table. Does it full refresh all tables in the source or only the modified one. Will the CDC fail while the new column has not been approved? Does dropping a table not remove it from a publciation? Is this not something that Postgres would handle internally?
k
A message from kapa.ai
Certainly! Here are answers to your specific questions, based strictly on the provided knowledge sources: --- ### 1. Does a new column require approving the schema change in Airbyte and then resync the entire table? Yes. When a new column is detected, you must approve the schema change in Airbyte. If you have enabled the "backfill new or renamed columns" option, Airbyte will resync the entire stream (table) so that all values in the new column are filled, even for rows that were not updated. If this option is not enabled, only updated rows will have values in the new column ([Schema Change Management](https://docs.airbyte.com/platform/1.7/using-airbyte/schema-change-management#backfill-new-or-renamed-columns-connection-setting)). --- ### 2. Does it full refresh all tables in the source or only the modified one? Only the modified stream (table) is resynced. The backfill is performed for the stream where the new or renamed column was detected, not for all tables in the source ([Schema Change Management](https://docs.airbyte.com/platform/1.7/using-airbyte/schema-change-management#backfill-new-or-renamed-columns-connection-setting)). --- ### 3. Will the CDC fail while the new column has not been approved? No, CDC will not fail, but the new column will not be included in the sync until you approve the schema change. Airbyte continues syncing according to your last saved schema. You need to manually approve any detected schema changes for them to be propagated ([Schema Change Management](https://docs.airbyte.com/platform/1.7/using-airbyte/schema-change-management#detect-and-propagate-schema-changes-connection-setting)). --- ### 4. Does dropping a table not remove it from a publication? Is this not something that Postgres would handle internally? The knowledge sources do not explicitly state whether dropping a table automatically removes it from a publication in Postgres. However, they do mention that you can use
ALTER PUBLICATION ... DROP TABLE ...
to remove a table from a publication. There is no clear statement in the sources about whether Postgres handles this automatically when a table is dropped, so I cannot confirm this detail based on the provided documentation ([Postgres Troubleshooting](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#connector-limitations)). --- If you need more details on the last point, you may want to consult the official Postgres documentation.