Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(warehouse-sources): record why an incremental sync is blocked (#91162)

Daniel RCefadd1d77963
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 1c9b0d32f55a..b34e7ab35467 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7464,6 +7464,10 @@ snapshots:
hash: v1.k794b7964.e7a413df9cb3388523740737801eb45647588b41aa26b1af2591f1027bd7b111.q8e8BaNl6LJbRusi5AFHOEjEux6ITpXReNUkJAdaNFY
scenes-app-data-warehouse-settings-schemas--default--light:
hash: v1.k794b7964.62abbaebed2e50cc731d2816d8ff2ffd75665676c1d448039b77697b11cfda3d.yhKMeKZR4Sv4nIaEdQNjBtd1fGZhog5pIDHUUPJZlaU
+ scenes-app-data-warehouse-settings-schemas--incremental-sync-blocked--dark:
+ hash: v1.k794b7964.4584fd922419e4058948d04a3923f994995ec8c9e74b35fe1d792528f1a9bb06.O4m_UffwNbHSkJq-ehb_EB5i5CSlBJE0A7RmqfMeZ5g
+ scenes-app-data-warehouse-settings-schemas--incremental-sync-blocked--light:
+ hash: v1.k794b7964.71ce8156c0796dc4f42059b238368d4ca7b5aa09dc8c080b510b6b7d3934190c.3yt8hLuRj8-mIfff1tauP2XWvSiW-IiBteLyQnnMVkQ
scenes-app-data-warehouse-settings-schemas--multi-schema--dark:
hash: v1.k794b7964.22840c30d80b9e1a3bd41d5a31af2ab81a54d9f90fb82d540fb9494b44cda050.oC_UUgUXZVqKMZ6LuInaQADAzqeWAvw2dZ8T5eENhIQ
scenes-app-data-warehouse-settings-schemas--multi-schema--light:
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index fbfd789f14fb..77fe83f4bdbb 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -94,7 +94,10 @@ import type { CommentSlackThreadRefApi } from 'products/platform_features/fronte
import type { InsightFilterOverrideContextApi } from 'products/product_analytics/frontend/generated/api.schemas'
import type { AIPromptConfigApi, DeliveryConfigApi } from 'products/subscriptions/frontend/generated/api.schemas'
import type { TaskRuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'
-import type { ExternalDataSourceTypeEnumApi } from 'products/warehouse_sources/frontend/generated/api.schemas'
+import type {
+ ExternalDataSourceTypeEnumApi,
+ IncrementalSyncBlockedReasonEnumApi,
+} from 'products/warehouse_sources/frontend/generated/api.schemas'
import { CyclotronInputType } from 'products/workflows/frontend/Workflows/hogflows/steps/types'
import type { HogFlow } from 'products/workflows/frontend/Workflows/hogflows/types'
@@ -6658,6 +6661,9 @@ export interface ExternalDataSourceSyncSchema {
row_filters?: RowFilter[] | null
}
+/** Why the last sync run could not merge rows on a table's primary key. */
+export type IncrementalSyncBlockedReason = IncrementalSyncBlockedReasonEnumApi
+
export interface ExternalDataSourceSchema extends SimpleExternalDataSourceSchema {
table?: SimpleDataWarehouseTable
incremental: boolean
@@ -6675,6 +6681,11 @@ export interface ExternalDataSourceSchema extends SimpleExternalDataSourceSchema
should_sync_default?: boolean
primary_key_columns: string[] | null
cdc_table_mode?: 'consolidated' | 'cdc_only' | 'both'
+ /**
+ * Why the last sync run could not merge rows on this table's primary key, or `null` when no such
+ * failure is current. A later run that succeeds, or fails for another reason, clears it.
+ */
+ incremental_sync_blocked?: IncrementalSyncBlockedReason | null
/**
* User-selected source columns to sync. `null` means "sync all columns".
* Primary-key + active incremental columns are always retained even if not listed.
diff --git a/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsx b/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsx
index d62452e1c72b..f02ace0afc4b 100644
--- a/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsx
+++ b/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsx
@@ -3,6 +3,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { IconInfo } from '@posthog/icons'
import {
+ LemonBanner,
LemonButton,
LemonDialog,
LemonInput,
@@ -40,6 +41,7 @@ import {
useSchemaEditorAccess,
} from 'products/data_warehouse/frontend/shared/components/SourceEditorAction'
import {
+ IncrementalSyncBlockedMessageMap,
StatusTagSetting,
SyncFrequencyLabelMap,
SyncTypeLabelMap,
@@ -189,6 +191,14 @@ function DetailsSection({
description="Enable or disable syncing for this schema, see its current state, and trigger a sync on demand."
/>
<div className="border rounded p-4 bg-surface-primary flex flex-col gap-3">
+ {schema.incremental_sync_blocked && (
+ <LemonBanner
+ type="warning"
+ action={{ children: 'Change sync method', onClick: onConfigureSyncMethod }}
+ >
+ {IncrementalSyncBlockedMessageMap[schema.incremental_sync_blocked]}
+ </LemonBanner>
+ )}
<div className="flex items-start justify-between gap-4">
<div className="flex flex-col">
<span>Enabled</span>
@@ -203,6 +213,9 @@ function DetailsSection({
checked={schema.should_sync}
label={schema.should_sync ? 'Syncing' : 'Disabled'}
onChange={(active) => {
+ // A blocked table is not routed away here on purpose. An operator who fixed
+ // the duplicates or added the key at the source has to be able to turn the
+ // table back on themselves; the banner above says what the last run found.
if (active && !schema.sync_type) {
// No sync method saved yet — open the sync method section to set one up.
onConfigureSyncMethod()
diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.stories.tsx b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.stories.tsx
index 513f1401c954..7ba20a3bb527 100644
--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.stories.tsx
+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.stories.tsx
@@ -65,3 +65,33 @@ export const MultiSchema: Story = {
return <SchemasTab {...props} />
},
}
+
+// A table a sync run proved can't merge: it is disabled, and its sync method carries the reason.
+const blockedSchemaSourceMock = {
+ ...externalDataSourceResponseMock,
+ schemas: externalDataSourceResponseMock.schemas.map((schema, index) =>
+ index === 1
+ ? {
+ ...schema,
+ should_sync: false,
+ status: 'Failed',
+ sync_type: 'incremental',
+ incremental_sync_blocked: 'duplicate_primary_key',
+ }
+ : schema
+ ),
+}
+
+export const IncrementalSyncBlocked: Story = {
+ render: (props) => {
+ useStorybookMocks({
+ get: {
+ '/api/environments/:team_id/external_data_sources/:id': () => {
+ return [200, blockedSchemaSourceMock]
+ },
+ },
+ })
+
+ return <SchemasTab {...props} />
+ },
+}
diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx
index 6aef9aae45e3..b525717dc558 100644
--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx
+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx
@@ -49,6 +49,7 @@ import {
} from 'products/data_warehouse/frontend/shared/components/SourceEditorAction'
import { sourceManagementLogic } from 'products/data_warehouse/frontend/shared/logics/sourceManagementLogic'
import {
+ IncrementalSyncBlockedMessageMap,
SYNC_FREQUENCY_ORDER,
StatusTagSetting,
SyncFrequencyLabelMap,
@@ -453,12 +454,20 @@ function ManagedSchemaTable({
{
title: 'Sync method',
key: 'sync_type',
- render: (_, schema) =>
- schema.sync_type ? (
- <LemonTag type="primary">{SyncTypeLabelMap[schema.sync_type]}</LemonTag>
- ) : (
- <span className="text-muted">Not set up</span>
- ),
+ render: (_, schema) => {
+ if (!schema.sync_type) {
+ return <span className="text-muted">Not set up</span>
+ }
+ const blockedReason = schema.incremental_sync_blocked
+ if (!blockedReason) {
+ return <LemonTag type="primary">{SyncTypeLabelMap[schema.sync_type]}</LemonTag>
+ }
+ return (
+ <Tooltip title={IncrementalSyncBlockedMessageMap[blockedReason]} interactive>
+ <LemonTag type="warning">{SyncTypeLabelMap[schema.sync_type]}</LemonTag>
+ </Tooltip>
+ )
+ },
},
{
title: 'Frequency',
@@ -549,9 +558,12 @@ function ManagedSchemaTable({
<LemonSwitch
checked={schema.should_sync}
onChange={(active) => {
- if (active && !schema.sync_type) {
+ if (active && (!schema.sync_type || schema.incremental_sync_blocked)) {
// No sync method saved yet — send the user to set one up
- // before the schema can be enabled.
+ // before the schema can be enabled. A schema whose sync
+ // method a run proved unusable goes to the same place,
+ // because the sync settings hold every resolution and
+ // re-enabling here would only repeat the failure.
router.actions.push(
urls.dataWarehouseSourceSchema(
prefixedSourceId,
diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts b/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts
index d899b90976c1..96e4849b10e4 100644
--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts
+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts
@@ -116,6 +116,7 @@ const NON_WRITABLE_SCHEMA_FIELDS = new Set<keyof ExternalDataSourceSchema>([
'description',
'available_columns',
'incremental',
+ 'incremental_sync_blocked',
'should_sync_default',
])
@@ -362,6 +363,8 @@ export function schemasNeedingLookbackResync(source: ExternalDataSource | null):
// Bulk-enable payloads: already-enabled schemas are skipped; schemas without a sync method ask
// the backend to discover and fill in default sync settings as part of the same update.
+// Blocked tables are enabled along with the rest on purpose. An operator who fixed the key or the
+// duplicates at the source for many tables at once has to be able to turn them back on in one go.
export function buildBulkEnablePayloads(
schemas: ExternalDataSourceSchema[]
): (Partial<ExternalDataSourceSchema> & Pick<ExternalDataSourceSchema, 'id'> & { apply_sync_defaults?: boolean })[] {
diff --git a/products/data_warehouse/frontend/utils.ts b/products/data_warehouse/frontend/utils.ts
index 9614e00c468a..4ef758bcdfe6 100644
--- a/products/data_warehouse/frontend/utils.ts
+++ b/products/data_warehouse/frontend/utils.ts
@@ -11,6 +11,7 @@ import {
ExternalDataSchemaStatus,
ExternalDataSourceSyncSchema,
HogFunctionTemplateType,
+ IncrementalSyncBlockedReason,
} from '~/types'
export type SyncInterval = DataWarehouseSyncInterval | DataModelingSyncInterval
@@ -168,6 +169,13 @@ export const SyncTypeLabelMap: Record<NonNullable<ExternalDataSourceSyncSchema['
xmin: 'xmin',
}
+export const IncrementalSyncBlockedMessageMap: Record<IncrementalSyncBlockedReason, string> = {
+ missing_primary_key:
+ "This table has no primary key, so it can't sync incrementally. Pick primary key columns, or change the sync method. If you added a primary key in the source, enable syncing to try again.",
+ duplicate_primary_key:
+ "The primary key used for this table isn't unique, so it can't sync incrementally. Remove the duplicate rows in the source and enable syncing to try again, or change the sync method. The key itself can't be changed once data has synced, unless you delete the synced data first.",
+}
+
export const SyncFrequencyLabelMap: Record<DataWarehouseSyncInterval, string> = {
'1min': '1 min',
'5min': '5 mins',
diff --git a/products/warehouse_sources/backend/facade/types.py b/products/warehouse_sources/backend/facade/types.py
index 6631e3a63949..706d4e2ff43d 100644
--- a/products/warehouse_sources/backend/facade/types.py
+++ b/products/warehouse_sources/backend/facade/types.py
@@ -1525,6 +1525,18 @@ class ExternalDataSchemaSyncType(models.TextChoices):
XMIN = "xmin", "xmin"
+class IncrementalSyncBlockedReason(models.TextChoices):
+ """Why the last sync run could not merge rows on a schema's primary key.
+
+ A missing key is a configuration state and stays until someone picks one. A duplicate key is a
+ data state: it can appear on a table that merged cleanly for months, and it clears when the
+ source stops repeating the key. Neither resolves by retrying the same run.
+ """
+
+ MISSING_PRIMARY_KEY = "missing_primary_key", "Missing primary key"
+ DUPLICATE_PRIMARY_KEY = "duplicate_primary_key", "Duplicate primary key"
+
+
class ExternalDataSchemaSyncFrequency(models.TextChoices):
DAILY = "day", "Daily"
WEEKLY = "week", "Weekly"
diff --git a/products/warehouse_sources/backend/models/external_data_schema.py b/products/warehouse_sources/backend/models/external_data_schema.py
index 5d78318db645..df7bcf7c5f58 100644
--- a/products/warehouse_sources/backend/models/external_data_schema.py
+++ b/products/warehouse_sources/backend/models/external_data_schema.py
@@ -32,6 +32,7 @@ from products.warehouse_sources.backend.types import (
ExternalDataSchemaSyncFrequency,
ExternalDataSchemaSyncType,
IncrementalFieldType,
+ IncrementalSyncBlockedReason,
)
if TYPE_CHECKING:
@@ -45,6 +46,43 @@ SYNC_DISABLED_JOB_ERROR = "Sync stopped because syncing was turned off"
SCHEMA_DELETED_JOB_ERROR = "Sync stopped because the table was deleted"
AUTO_DISABLED_JOB_ERROR = "Sync stopped because of an error that retrying would not fix"
+# `Any_Source_Errors` rewrites the raised exception into this copy, so a blocked schema carries it
+# as `latest_error`. Matched below, not only displayed.
+MISSING_PRIMARY_KEY_DISABLED_MESSAGE = (
+ "This table needs a primary key to sync incrementally, but none is set. Choose a primary key "
+ "for the table in its sync settings, or switch it to full table replication, then re-enable the sync."
+)
+DUPLICATE_PRIMARY_KEY_DISABLED_MESSAGE = (
+ "The primary key set for this table isn't unique, so incremental syncing can't reliably match "
+ "rows to update. Choose a unique primary key in the table's sync settings, or switch it to full "
+ "table replication, then re-enable the sync."
+)
+
+# Runs that fail outside the workflow record the raw text instead. Copied from
+# `pipelines/core/arrow_utils.py`, which would pull pyarrow onto the Django model path; a test
+# holds the two in step.
+MISSING_PRIMARY_KEYS_RAW_ERROR = "Primary key required for incremental syncs"
+DUPLICATE_PRIMARY_KEYS_RAW_ERROR = "The primary keys for this table are not unique"
+
+_INCREMENTAL_SYNC_BLOCKED_MARKERS: tuple[tuple[str, IncrementalSyncBlockedReason], ...] = (
+ (MISSING_PRIMARY_KEY_DISABLED_MESSAGE, IncrementalSyncBlockedReason.MISSING_PRIMARY_KEY),
+ (MISSING_PRIMARY_KEYS_RAW_ERROR, IncrementalSyncBlockedReason.MISSING_PRIMARY_KEY),
+ (DUPLICATE_PRIMARY_KEY_DISABLED_MESSAGE, IncrementalSyncBlockedReason.DUPLICATE_PRIMARY_KEY),
+ (DUPLICATE_PRIMARY_KEYS_RAW_ERROR, IncrementalSyncBlockedReason.DUPLICATE_PRIMARY_KEY),
+)
+
+
+def incremental_sync_blocked_reason(latest_error: str | None) -> str | None:
+ """Classify a sync error as one of the two states a customer resolves by changing the key.
+
+ Reading the error keeps this in step with the failure by construction: a successful run clears
+ `latest_error`, and a different failure replaces it, so there is no second state to expire.
+ """
+ if not latest_error:
+ return None
+ return next((reason.value for marker, reason in _INCREMENTAL_SYNC_BLOCKED_MARKERS if marker in latest_error), None)
+
+
# How stale a rewrite checkpoint may get before its import hold lapses. Generous on purpose: a
# multi-budget rewrite renews the stamp on every advancing attempt, and attempts arrive at the
# schema's own sync cadence, which can be six hours apart. The number that matters is the ceiling on
@@ -587,6 +625,11 @@ class ExternalDataSchema(ModelActivityMixin, CreatedMetaFields, UpdatedMetaField
return None
+ @property
+ def incremental_sync_blocked(self) -> str | None:
+ """Why the last run proved this schema's incremental sync can never succeed, if it did."""
+ return incremental_sync_blocked_reason(self.latest_error)
+
@property
def chunk_size_override(self) -> int | None:
if self.sync_type_config:
diff --git a/products/warehouse_sources/backend/presentation/views/external_data_schema.py b/products/warehouse_sources/backend/presentation/views/external_data_schema.py
index 4e5ccd4eb208..8fd449645086 100644
--- a/products/warehouse_sources/backend/presentation/views/external_data_schema.py
+++ b/products/warehouse_sources/backend/presentation/views/external_data_schema.py
@@ -64,7 +64,11 @@ from products.warehouse_sources.backend.facade.source_management import (
source_type_supports_cdc,
validate_and_coerce_row_filters,
)
-from products.warehouse_sources.backend.facade.types import ExternalDataSourceType, IncrementalFieldType
+from products.warehouse_sources.backend.facade.types import (
+ ExternalDataSourceType,
+ IncrementalFieldType,
+ IncrementalSyncBlockedReason,
+)
from products.warehouse_sources.backend.presentation.views.destination_links import (
DestinationLinkSerializer,
SchemaDestinationsSerializer,
@@ -374,6 +378,25 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers
allow_null=True,
help_text="For CDC syncs: consolidated, cdc_only, or both.",
)
+ incremental_sync_blocked = serializers.ChoiceField(
+ choices=IncrementalSyncBlockedReason.choices,
+ read_only=True,
+ allow_null=True,
+ help_text=(
+ "Why the last sync run could not merge rows for this table, or `null` when no such failure "
+ "is current, which includes a run that failed for another reason. A blocked table is "
+ "disabled, and the resolution differs by reason. "
+ "`missing_primary_key`: no key to merge on, so set `primary_key_columns` to a unique "
+ "key, which is accepted because none was set before. `duplicate_primary_key`: the key "
+ "in use does not identify one row, and that key cannot be swapped once data has synced, "
+ "so either remove the duplicates at the source and set `should_sync` to true, or delete "
+ "the synced data before setting a different key. Either reason also accepts a different "
+ "`sync_type`: `append` is only safe for insert-only tables, because updated rows arrive "
+ "again as duplicates, and `full_refresh` re-reads the whole table on every sync and "
+ "bills every row. This reports the last run's failure, so it clears once a run succeeds "
+ "or fails for another reason, not when an update lands."
+ ),
+ )
enabled_columns = serializers.ListField(
child=serializers.CharField(),
required=False,
@@ -453,6 +476,7 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers
"description",
"primary_key_columns",
"cdc_table_mode",
+ "incremental_sync_blocked",
"enabled_columns",
"row_filters",
"available_columns",
@@ -471,6 +495,7 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers
"last_synced_at",
"latest_error",
"status",
+ "incremental_sync_blocked",
"description",
"available_columns",
"source_column_metadata_available",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
index 1cde1bf9113f..c769891df0f5 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
@@ -44,6 +44,8 @@ from products.warehouse_sources.backend.billing import billed_usage_for_job
from products.warehouse_sources.backend.models.external_data_job import ExternalDataJob
from products.warehouse_sources.backend.models.external_data_schema import (
AUTO_DISABLED_JOB_ERROR,
+ DUPLICATE_PRIMARY_KEY_DISABLED_MESSAGE,
+ MISSING_PRIMARY_KEY_DISABLED_MESSAGE,
ExternalDataSchema,
update_should_sync,
)
@@ -58,6 +60,10 @@ from products.warehouse_sources.backend.temporal.data_imports.metrics import (
get_v3_lock_skipped_metric,
get_version_check_skipped_metric,
)
+from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.arrow_utils import (
+ DUPLICATE_PRIMARY_KEYS_ERROR,
+ MISSING_PRIMARY_KEYS_ERROR,
+)
from products.warehouse_sources.backend.temporal.data_imports.post_import_job import (
PostImportWorkflow,
PostImportWorkflowInputs,
@@ -152,15 +158,8 @@ Any_Source_Errors: dict[str, str | None] = {
"(private key, passphrase, or username and password) on the source's SSH tunnel "
"configuration, then re-enable the sync."
),
- "Primary key required for incremental syncs": (
- "This table needs a primary key to sync incrementally, but none is set. Choose a primary key "
- "for the table in its sync settings, or switch it to full table replication, then re-enable the sync."
- ),
- "The primary keys for this table are not unique": (
- "The primary key set for this table isn't unique, so incremental syncing can't reliably match "
- "rows to update. Choose a unique primary key in the table's sync settings, or switch it to full "
- "table replication, then re-enable the sync."
- ),
+ MISSING_PRIMARY_KEYS_ERROR: MISSING_PRIMARY_KEY_DISABLED_MESSAGE,
+ DUPLICATE_PRIMARY_KEYS_ERROR: DUPLICATE_PRIMARY_KEY_DISABLED_MESSAGE,
"Integration matching query does not exist": MISSING_INTEGRATION_MESSAGE,
# `OAuthMixin.get_oauth_integration` catches `Integration.DoesNotExist` and re-raises these
# two, so the ORM wording above never reaches here for the sources that go through it. Left
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/common/extract.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/common/extract.py
index 73bed95a728c..8faac65f4369 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/common/extract.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/common/extract.py
@@ -18,6 +18,7 @@ from posthog.utils import get_machine_id
from products.warehouse_sources.backend.temporal.data_imports.pipelines.common.load import get_incremental_field_value
from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.arrow_utils import (
+ DUPLICATE_PRIMARY_KEYS_ERROR,
BillingLimitsWillBeReachedException,
DuplicatePrimaryKeysException,
MissingPrimaryKeysException,
@@ -369,7 +370,7 @@ def validate_incremental_sync(
) -> None:
if is_incremental and resource.has_duplicate_primary_keys:
raise DuplicatePrimaryKeysException(
- f"The primary keys for this table are not unique. We can't sync incrementally until the table "
+ f"{DUPLICATE_PRIMARY_KEYS_ERROR}. We can't sync incrementally until the table "
f"has a unique primary key. Primary keys being used are: {resource.primary_keys}"
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/arrow_utils.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/arrow_utils.py
index 3af10de2dcc7..e29073002df7 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/arrow_utils.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/arrow_utils.py
@@ -63,12 +63,19 @@ class BillingLimitsWillBeReachedException(NonReportableError):
and subclassing NonReportableError keeps it out of error tracking."""
+# Matched as a substring by the shared non-retryable classification (`Any_Source_Errors`) and by the
+# import teardown that records why an incremental sync is blocked, so keep the wording in step with
+# them. The raised message continues past this prefix with the keys that were used.
+DUPLICATE_PRIMARY_KEYS_ERROR = "The primary keys for this table are not unique"
+
+
class DuplicatePrimaryKeysException(Exception):
pass
-# Matched as a substring by the shared non-retryable classification (`Any_Source_Errors`) and by the
-# v3 load consumer, so both keep recognizing the condition — keep the wording in step with them.
+# Matched as a substring by the shared non-retryable classification (`Any_Source_Errors`), by the
+# v3 load consumer, and by the import teardown that records why an incremental sync is blocked, so
+# all three keep recognizing the condition. Keep the wording in step with them.
MISSING_PRIMARY_KEYS_ERROR = "Primary key required for incremental syncs"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_end_to_end.py b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_end_to_end.py
index 1548c2908c8e..c694e5cadb7b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_end_to_end.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_end_to_end.py
@@ -128,6 +128,7 @@ from products.warehouse_sources.backend.types import (
ExternalDataJobStatus,
ExternalDataSchemaStatus,
ExternalDataSchemaSyncType,
+ IncrementalSyncBlockedReason,
)
BUCKET_NAME = "test-pipeline"
@@ -3222,6 +3223,7 @@ async def test_postgres_duplicate_primary_key(team, postgres_config, postgres_co
disable_error_message=job.latest_error,
disable_exclude_workflow_id=mock.ANY,
)
+ assert schema.incremental_sync_blocked == IncrementalSyncBlockedReason.DUPLICATE_PRIMARY_KEY
@pytest.mark.django_db(transaction=True)
diff --git a/products/warehouse_sources/backend/tests/api/test_external_data_source.py b/products/warehouse_sources/backend/tests/api/test_external_data_source.py
index 31365b973ef2..b1ec7483723d 100644
--- a/products/warehouse_sources/backend/tests/api/test_external_data_source.py
+++ b/products/warehouse_sources/backend/tests/api/test_external_data_source.py
@@ -3094,6 +3094,7 @@ class TestExternalDataSource(APIBaseTest):
"description": schema.description,
"primary_key_columns": None,
"cdc_table_mode": "consolidated",
+ "incremental_sync_blocked": None,
"enabled_columns": None,
"row_filters": None,
"available_columns": [],
diff --git a/products/warehouse_sources/backend/tests/test_models.py b/products/warehouse_sources/backend/tests/test_models.py
index 8507d730330a..bed9b61091bd 100644
--- a/products/warehouse_sources/backend/tests/test_models.py
+++ b/products/warehouse_sources/backend/tests/test_models.py
@@ -21,6 +21,10 @@ from posthog.models.team import Team
from products.warehouse_sources.backend.models.credential import DataWarehouseCredential
from products.warehouse_sources.backend.models.external_data_job import ExternalDataJob
from products.warehouse_sources.backend.models.external_data_schema import (
+ DUPLICATE_PRIMARY_KEY_DISABLED_MESSAGE,
+ DUPLICATE_PRIMARY_KEYS_RAW_ERROR,
+ MISSING_PRIMARY_KEY_DISABLED_MESSAGE,
+ MISSING_PRIMARY_KEYS_RAW_ERROR,
REPARTITION_HOLD_MAX_AGE,
ExternalDataSchema,
apply_incremental_lookback,
@@ -1283,6 +1287,36 @@ class TestRepartitionHoldsImport:
assert schema.repartition_holds_import is True
+class TestIncrementalSyncBlocked(SimpleTestCase):
+ @parameterized.expand(
+ [
+ ("friendly_missing", MISSING_PRIMARY_KEY_DISABLED_MESSAGE, "missing_primary_key"),
+ ("friendly_duplicate", DUPLICATE_PRIMARY_KEY_DISABLED_MESSAGE, "duplicate_primary_key"),
+ ("raw_missing", f"MissingPrimaryKeysException: {MISSING_PRIMARY_KEYS_RAW_ERROR}", "missing_primary_key"),
+ (
+ "raw_duplicate",
+ f"DuplicatePrimaryKeysException: {DUPLICATE_PRIMARY_KEYS_RAW_ERROR}. Primary keys being used are: ['id']",
+ "duplicate_primary_key",
+ ),
+ ("unrelated_failure", "Your SSH tunnel credentials are not valid", None),
+ ("healthy_schema", None, None),
+ ]
+ )
+ def test_only_a_key_failure_reports_a_blocked_sync(
+ self, _name: str, latest_error: str | None, expected: str | None
+ ) -> None:
+ assert ExternalDataSchema(latest_error=latest_error).incremental_sync_blocked == expected
+
+ def test_blocked_markers_match_the_raised_errors(self) -> None:
+ from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.arrow_utils import ( # noqa: PLC0415 — pulls pyarrow, which the model path must not import
+ DUPLICATE_PRIMARY_KEYS_ERROR,
+ MISSING_PRIMARY_KEYS_ERROR,
+ )
+
+ assert MISSING_PRIMARY_KEYS_RAW_ERROR == MISSING_PRIMARY_KEYS_ERROR
+ assert DUPLICATE_PRIMARY_KEYS_RAW_ERROR == DUPLICATE_PRIMARY_KEYS_ERROR
+
+
class TestMergeConnectionMetadata(BaseTest):
def _source(self, connection_metadata: Any) -> ExternalDataSource:
return ExternalDataSource.objects.create(
diff --git a/products/warehouse_sources/backend/types.py b/products/warehouse_sources/backend/types.py
index 59e157d0f72c..1bc6f0eab4c9 100644
--- a/products/warehouse_sources/backend/types.py
+++ b/products/warehouse_sources/backend/types.py
@@ -17,6 +17,7 @@ from products.warehouse_sources.backend.facade.types import (
ExternalDataSourceType as ExternalDataSourceType,
IncrementalField as IncrementalField,
IncrementalFieldType as IncrementalFieldType,
+ IncrementalSyncBlockedReason as IncrementalSyncBlockedReason,
ManagedWarehouseSQLMode as ManagedWarehouseSQLMode,
PartitionSettings as PartitionSettings,
WarehouseColumnAnnotationDescriptionSource as WarehouseColumnAnnotationDescriptionSource,
diff --git a/products/warehouse_sources/frontend/generated/api.schemas.ts b/products/warehouse_sources/frontend/generated/api.schemas.ts
index 8341dab407ed..d562dccf4b8e 100644
--- a/products/warehouse_sources/frontend/generated/api.schemas.ts
+++ b/products/warehouse_sources/frontend/generated/api.schemas.ts
@@ -190,6 +190,18 @@ export const CdcTableModeEnumApi = {
Both: 'both',
} as const
+/**
+ * * `missing_primary_key` - Missing primary key
+ * * `duplicate_primary_key` - Duplicate primary key
+ */
+export type IncrementalSyncBlockedReasonEnumApi =
+ (typeof IncrementalSyncBlockedReasonEnumApi)[keyof typeof IncrementalSyncBlockedReasonEnumApi]
+
+export const IncrementalSyncBlockedReasonEnumApi = {
+ MissingPrimaryKey: 'missing_primary_key',
+ DuplicatePrimaryKey: 'duplicate_primary_key',
+} as const
+
export interface ExternalDataSourceApiVersionDeprecationApi {
/** The deprecated vendor API version this source is pinned to. */
version: string
@@ -322,6 +334,11 @@ export interface ExternalDataSchemaApi {
* * `cdc_only` - cdc_only
* * `both` - both */
cdc_table_mode?: CdcTableModeEnumApi | null
+ /** Why the last sync run could not merge rows for this table, or `null` when no such failure is current, which includes a run that failed for another reason. A blocked table is disabled, and the resolution differs by reason. `missing_primary_key`: no key to merge on, so set `primary_key_columns` to a unique key, which is accepted because none was set before. `duplicate_primary_key`: the key in use does not identify one row, and that key cannot be swapped once data has synced, so either remove the duplicates at the source and set `should_sync` to true, or delete the synced data before setting a different key. Either reason also accepts a different `sync_type`: `append` is only safe for insert-only tables, because updated rows arrive again as duplicates, and `full_refresh` re-reads the whole table on every sync and bills every row. This reports the last run's failure, so it clears once a run succeeds or fails for another reason, not when an update lands.
+ *
+ * * `missing_primary_key` - Missing primary key
+ * * `duplicate_primary_key` - Duplicate primary key */
+ readonly incremental_sync_blocked: IncrementalSyncBlockedReasonEnumApi | null
/**
* Names of source columns to sync. `null` (default) syncs all columns. Primary-key columns and the active incremental field are always retained, even if not listed here.
* @nullable
@@ -485,6 +502,11 @@ export interface PatchedExternalDataSchemaApi {
* * `cdc_only` - cdc_only
* * `both` - both */
cdc_table_mode?: CdcTableModeEnumApi | null
+ /** Why the last sync run could not merge rows for this table, or `null` when no such failure is current, which includes a run that failed for another reason. A blocked table is disabled, and the resolution differs by reason. `missing_primary_key`: no key to merge on, so set `primary_key_columns` to a unique key, which is accepted because none was set before. `duplicate_primary_key`: the key in use does not identify one row, and that key cannot be swapped once data has synced, so either remove the duplicates at the source and set `should_sync` to true, or delete the synced data before setting a different key. Either reason also accepts a different `sync_type`: `append` is only safe for insert-only tables, because updated rows arrive again as duplicates, and `full_refresh` re-reads the whole table on every sync and bills every row. This reports the last run's failure, so it clears once a run succeeds or fails for another reason, not when an update lands.
+ *
+ * * `missing_primary_key` - Missing primary key
+ * * `duplicate_primary_key` - Duplicate primary key */
+ readonly incremental_sync_blocked?: IncrementalSyncBlockedReasonEnumApi | null
/**
* Names of source columns to sync. `null` (default) syncs all columns. Primary-key columns and the active incremental field are always retained, even if not listed here.
* @nullable
diff --git a/products/warehouse_sources/mcp/tools.yaml b/products/warehouse_sources/mcp/tools.yaml
index c1715085b865..909792b7bddf 100644
--- a/products/warehouse_sources/mcp/tools.yaml
+++ b/products/warehouse_sources/mcp/tools.yaml
@@ -208,7 +208,11 @@ tools:
an external source. Returns the schema name, sync status, sync frequency, incremental field configuration,
last_synced_at, and latest error. Use this to see which tables are actively syncing and their health. To
check one table's freshness, pass `search` with the table/schema name to narrow to that schema. Column
- definitions are omitted here — use external-data-schemas-retrieve for a single schema's columns.
+ definitions are omitted here — use external-data-schemas-retrieve for a single schema's columns. When a
+ table stopped syncing, check `incremental_sync_blocked`: it names why the last run could not merge on the
+ table's primary key, and the table is disabled until that is resolved. A retry with nothing changed fails
+ the same way; a later run that succeeds, or fails for another reason, clears it. That field's description
+ lists the resolutions, which are applied with 'external-data-schemas-partial-update'.
response:
exclude:
- table.columns
@@ -233,7 +237,12 @@ tools:
retroactively. Before changing incremental_field or sync_type, call
'external-data-schemas-incremental-fields-create' to see which fields and sync methods the source actually
supports; before switching to cdc, validate with 'external-data-sources-check-cdc-prerequisites-create'. To
- run a sync immediately after reconfiguring, use 'external-data-schemas-reload'."
+ run a sync immediately after reconfiguring, use 'external-data-schemas-reload'. This is also how a table
+ reported by `incremental_sync_blocked` is resolved: send primary_key_columns, or a different sync_type, or
+ should_sync=true to retry a table fixed at the source. For `duplicate_primary_key`, a different key is
+ refused once data has synced, because rows already merged under the old key would repeat; delete the synced
+ data first with 'external-data-schemas-delete-data', or fix the duplicates at the source and retry. That
+ field reports the last run's failure, so it clears once a run succeeds rather than when the update lands."
external-data-schemas-reload:
operation: external_data_schemas_reload_create
enabled: true
@@ -273,7 +282,9 @@ tools:
title: Get data warehouse table schema
description: >
Get a single table schema by ID. Returns full details including sync status, sync frequency, incremental
- field, latest error, and the associated source and table metadata.
+ field, primary key columns, latest error, `incremental_sync_blocked`, and the associated source and table
+ metadata. Read `incremental_sync_blocked` before diagnosing a table that stopped syncing: it names why the
+ last run could not merge on the primary key, and its description lists the resolutions.
external-data-schemas-update:
operation: external_data_schemas_update
enabled: false
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 3a7eeb22cb2a..75cd7a94acce 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -4922,7 +4922,7 @@
}
},
"external-data-schemas-list": {
- "description": "List all table schemas across all data warehouse sources. Each schema represents one table being synced from an external source. Returns the schema name, sync status, sync frequency, incremental field configuration, last_synced_at, and latest error. Use this to see which tables are actively syncing and their health. To check one table's freshness, pass `search` with the table/schema name to narrow to that schema. Column definitions are omitted here — use external-data-schemas-retrieve for a single schema's columns.",
+ "description": "List all table schemas across all data warehouse sources. Each schema represents one table being synced from an external source. Returns the schema name, sync status, sync frequency, incremental field configuration, last_synced_at, and latest error. Use this to see which tables are actively syncing and their health. To check one table's freshness, pass `search` with the table/schema name to narrow to that schema. Column definitions are omitted here — use external-data-schemas-retrieve for a single schema's columns. When a table stopped syncing, check `incremental_sync_blocked`: it names why the last run could not merge on the table's primary key, and the table is disabled until that is resolved. A retry with nothing changed fails the same way; a later run that succeeds, or fails for another reason, clears it. That field's description lists the resolutions, which are applied with 'external-data-schemas-partial-update'.",
"category": "Warehouse sources",
"feature": "warehouse_sources",
"summary": "List data warehouse table schemas (imported tables)",
@@ -4936,7 +4936,7 @@
}
},
"external-data-schemas-partial-update": {
- "description": "Update one table schema's sync configuration: enable/disable syncing (should_sync), sync_type (incremental, full_refresh, append, webhook, cdc, xmin), sync frequency and UTC time of day, incremental field (plus type and lookback window), primary key columns, CDC table mode, column selection (enabled_columns), row filters, and vendor API version. Changes take effect on the next sync, not retroactively. Before changing incremental_field or sync_type, call 'external-data-schemas-incremental-fields-create' to see which fields and sync methods the source actually supports; before switching to cdc, validate with 'external-data-sources-check-cdc-prerequisites-create'. To run a sync immediately after reconfiguring, use 'external-data-schemas-reload'.",
+ "description": "Update one table schema's sync configuration: enable/disable syncing (should_sync), sync_type (incremental, full_refresh, append, webhook, cdc, xmin), sync frequency and UTC time of day, incremental field (plus type and lookback window), primary key columns, CDC table mode, column selection (enabled_columns), row filters, and vendor API version. Changes take effect on the next sync, not retroactively. Before changing incremental_field or sync_type, call 'external-data-schemas-incremental-fields-create' to see which fields and sync methods the source actually supports; before switching to cdc, validate with 'external-data-sources-check-cdc-prerequisites-create'. To run a sync immediately after reconfiguring, use 'external-data-schemas-reload'. This is also how a table reported by `incremental_sync_blocked` is resolved: send primary_key_columns, or a different sync_type, or should_sync=true to retry a table fixed at the source. For `duplicate_primary_key`, a different key is refused once data has synced, because rows already merged under the old key would repeat; delete the synced data first with 'external-data-schemas-delete-data', or fix the duplicates at the source and retry. That field reports the last run's failure, so it clears once a run succeeds rather than when the update lands.",
"category": "Warehouse sources",
"feature": "warehouse_sources",
"summary": "Update data warehouse table schema sync config",
@@ -4978,7 +4978,7 @@
}
},
"external-data-schemas-retrieve": {
- "description": "Get a single table schema by ID. Returns full details including sync status, sync frequency, incremental field, latest error, and the associated source and table metadata.",
+ "description": "Get a single table schema by ID. Returns full details including sync status, sync frequency, incremental field, primary key columns, latest error, `incremental_sync_blocked`, and the associated source and table metadata. Read `incremental_sync_blocked` before diagnosing a table that stopped syncing: it names why the last run could not merge on the primary key, and its description lists the resolutions.",
"category": "Warehouse sources",
"feature": "warehouse_sources",
"summary": "Get data warehouse table schema",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 58088a2a76b7..e2021cdc192c 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -5021,7 +5021,7 @@
}
},
"external-data-schemas-list": {
- "description": "List all table schemas across all data warehouse sources. Each schema represents one table being synced from an external source. Returns the schema name, sync status, sync frequency, incremental field configuration, last_synced_at, and latest error. Use this to see which tables are actively syncing and their health. To check one table's freshness, pass `search` with the table/schema name to narrow to that schema. Column definitions are omitted here — use external-data-schemas-retrieve for a single schema's columns.",
+ "description": "List all table schemas across all data warehouse sources. Each schema represents one table being synced from an external source. Returns the schema name, sync status, sync frequency, incremental field configuration, last_synced_at, and latest error. Use this to see which tables are actively syncing and their health. To check one table's freshness, pass `search` with the table/schema name to narrow to that schema. Column definitions are omitted here — use external-data-schemas-retrieve for a single schema's columns. When a table stopped syncing, check `incremental_sync_blocked`: it names why the last run could not merge on the table's primary key, and the table is disabled until that is resolved. A retry with nothing changed fails the same way; a later run that succeeds, or fails for another reason, clears it. That field's description lists the resolutions, which are applied with 'external-data-schemas-partial-update'.",
"category": "Warehouse sources",
"feature": "warehouse_sources",
"summary": "List data warehouse table schemas (imported tables)",
@@ -5035,7 +5035,7 @@
}
},
"external-data-schemas-partial-update": {
- "description": "Update one table schema's sync configuration: enable/disable syncing (should_sync), sync_type (incremental, full_refresh, append, webhook, cdc, xmin), sync frequency and UTC time of day, incremental field (plus type and lookback window), primary key columns, CDC table mode, column selection (enabled_columns), row filters, and vendor API version. Changes take effect on the next sync, not retroactively. Before changing incremental_field or sync_type, call 'external-data-schemas-incremental-fields-create' to see which fields and sync methods the source actually supports; before switching to cdc, validate with 'external-data-sources-check-cdc-prerequisites-create'. To run a sync immediately after reconfiguring, use 'external-data-schemas-reload'.",
+ "description": "Update one table schema's sync configuration: enable/disable syncing (should_sync), sync_type (incremental, full_refresh, append, webhook, cdc, xmin), sync frequency and UTC time of day, incremental field (plus type and lookback window), primary key columns, CDC table mode, column selection (enabled_columns), row filters, and vendor API version. Changes take effect on the next sync, not retroactively. Before changing incremental_field or sync_type, call 'external-data-schemas-incremental-fields-create' to see which fields and sync methods the source actually supports; before switching to cdc, validate with 'external-data-sources-check-cdc-prerequisites-create'. To run a sync immediately after reconfiguring, use 'external-data-schemas-reload'. This is also how a table reported by `incremental_sync_blocked` is resolved: send primary_key_columns, or a different sync_type, or should_sync=true to retry a table fixed at the source. For `duplicate_primary_key`, a different key is refused once data has synced, because rows already merged under the old key would repeat; delete the synced data first with 'external-data-schemas-delete-data', or fix the duplicates at the source and retry. That field reports the last run's failure, so it clears once a run succeeds rather than when the update lands.",
"category": "Warehouse sources",
"feature": "warehouse_sources",
"summary": "Update data warehouse table schema sync config",
@@ -5077,7 +5077,7 @@
}
},
"external-data-schemas-retrieve": {
- "description": "Get a single table schema by ID. Returns full details including sync status, sync frequency, incremental field, latest error, and the associated source and table metadata.",
+ "description": "Get a single table schema by ID. Returns full details including sync status, sync frequency, incremental field, primary key columns, latest error, `incremental_sync_blocked`, and the associated source and table metadata. Read `incremental_sync_blocked` before diagnosing a table that stopped syncing: it names why the last run could not merge on the primary key, and its description lists the resolutions.",
"category": "Warehouse sources",
"feature": "warehouse_sources",
"summary": "Get data warehouse table schema",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index d9df2b0be008..1548b73cedd1 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -38427,6 +38427,18 @@ export namespace Schemas {
'30day': '30day',
} as const;
+ /**
+ * * `missing_primary_key` - Missing primary key
+ * * `duplicate_primary_key` - Duplicate primary key
+ */
+ export type IncrementalSyncBlockedReasonEnum = typeof IncrementalSyncBlockedReasonEnum[keyof typeof IncrementalSyncBlockedReasonEnum];
+
+
+ export const IncrementalSyncBlockedReasonEnum = {
+ MissingPrimaryKey: 'missing_primary_key',
+ DuplicatePrimaryKey: 'duplicate_primary_key',
+ } as const;
+
export interface ExternalDataSourceApiVersionDeprecation {
/** The deprecated vendor API version this source is pinned to. */
version: string;
@@ -38522,6 +38534,11 @@ export namespace Schemas {
* * `cdc_only` - cdc_only
* * `both` - both */
cdc_table_mode?: CdcTableModeEnum | null;
+ /** Why the last sync run could not merge rows for this table, or `null` when no such failure is current, which includes a run that failed for another reason. A blocked table is disabled, and the resolution differs by reason. `missing_primary_key`: no key to merge on, so set `primary_key_columns` to a unique key, which is accepted because none was set before. `duplicate_primary_key`: the key in use does not identify one row, and that key cannot be swapped once data has synced, so either remove the duplicates at the source and set `should_sync` to true, or delete the synced data before setting a different key. Either reason also accepts a different `sync_type`: `append` is only safe for insert-only tables, because updated rows arrive again as duplicates, and `full_refresh` re-reads the whole table on every sync and bills every row. This reports the last run's failure, so it clears once a run succeeds or fails for another reason, not when an update lands.
+ *
+ * * `missing_primary_key` - Missing primary key
+ * * `duplicate_primary_key` - Duplicate primary key */
+ readonly incremental_sync_blocked: IncrementalSyncBlockedReasonEnum | null;
/**
* Names of source columns to sync. `null` (default) syncs all columns. Primary-key columns and the active incremental field are always retained, even if not listed here.
* @nullable
@@ -67048,6 +67065,11 @@ export namespace Schemas {
* * `cdc_only` - cdc_only
* * `both` - both */
cdc_table_mode?: CdcTableModeEnum | null;
+ /** Why the last sync run could not merge rows for this table, or `null` when no such failure is current, which includes a run that failed for another reason. A blocked table is disabled, and the resolution differs by reason. `missing_primary_key`: no key to merge on, so set `primary_key_columns` to a unique key, which is accepted because none was set before. `duplicate_primary_key`: the key in use does not identify one row, and that key cannot be swapped once data has synced, so either remove the duplicates at the source and set `should_sync` to true, or delete the synced data before setting a different key. Either reason also accepts a different `sync_type`: `append` is only safe for insert-only tables, because updated rows arrive again as duplicates, and `full_refresh` re-reads the whole table on every sync and bills every row. This reports the last run's failure, so it clears once a run succeeds or fails for another reason, not when an update lands.
+ *
+ * * `missing_primary_key` - Missing primary key
+ * * `duplicate_primary_key` - Duplicate primary key */
+ readonly incremental_sync_blocked?: IncrementalSyncBlockedReasonEnum | null;
/**
* Names of source columns to sync. `null` (default) syncs all columns. Primary-key columns and the active incremental field are always retained, even if not listed here.
* @nullable