From 048eb21d110f488e8fbdb3b15d0a86f2e96cd3d4 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:57:41 +0000 Subject: [PATCH] fix: Allow composite primary keys in PyAirbyte - Fixed validation logic in catalog_providers.py that incorrectly rejected composite primary keys - Changed validation from checking column count to checking for nested field references (dots) - Composite keys like ['id', 'category'] now work correctly - Nested keys like ['data.id'] are still properly rejected - All existing unit tests pass Fixes issue where set_primary_keys(stream=['col1', 'col2']) would fail with 'Nested primary keys are not supported' error despite composite keys being supported. Co-Authored-By: AJ Steers --- airbyte/shared/catalog_providers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airbyte/shared/catalog_providers.py b/airbyte/shared/catalog_providers.py index bf22a76b..0da74839 100644 --- a/airbyte/shared/catalog_providers.py +++ b/airbyte/shared/catalog_providers.py @@ -155,11 +155,11 @@ def get_primary_keys( ] for pk_nodes in normalized_pks: - if len(pk_nodes) != 1: + if any("." in node for node in pk_nodes): raise exc.AirbyteError( message=( "Nested primary keys are not supported. " - "Each PK column should have exactly one node. " + "Primary key columns should reference top-level fields only. " ), context={ "stream_name": stream_name,