Skip to content

fix: treat empty string cursor field as no cursor field#875

Merged
Aaron ("AJ") Steers (aaronsteers) merged 1 commit intomainfrom
devin/1767815288-fix-empty-cursor-field
Jan 8, 2026
Merged

fix: treat empty string cursor field as no cursor field#875
Aaron ("AJ") Steers (aaronsteers) merged 1 commit intomainfrom
devin/1767815288-fix-empty-cursor-field

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where cursor_field: [""] (list with empty string) was incorrectly treated as a valid cursor field, causing invalid SQL generation in destinations like Redshift. The error manifests as zero-length delimited identifier at or near """" when the platform serializes "no cursor configured" streams as [""] instead of [].

This PR adds defensive checks in two locations to treat empty string cursor fields as "no cursor field":

  • _get_catalog_defined_cursor_field() in model_to_component_factory.py
  • get_cursor_field_from_stream() in helpers.py

When an empty string cursor is detected, the code now falls back to the default cursor field defined in the manifest.

Fixes airbytehq/oncall#10700

Review & Testing Checklist for Human

  • Verify the short-circuit logic is correct: not configured_stream.cursor_field must evaluate True for empty lists [] to prevent IndexError on cursor_field[0]
  • Confirm that treating [""] as "no cursor" is the correct behavior (vs. raising an error)
  • Note: No unit test was added for the helpers.py change - consider if this is acceptable

Suggested test plan:

  1. Run the existing cursor-related tests: pytest unit_tests/sources/declarative/parsers/test_model_to_component_factory.py -k "cursor" -v
  2. If possible, test with a real connection that previously failed with the empty cursor field error

Notes

When cursor_field is [''] (list with empty string) instead of []
(empty list), treat it as no cursor field. This can occur when the
platform serializes 'no cursor configured' streams incorrectly.

Fixes airbytehq/oncall#10700

Co-Authored-By: unknown <>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Original prompt from API User
Comment from @aaronsteers: /ai-fix

We suspect the root cause is here. Fix there in the Python CDK if so: https://github.com/airbytehq/airbyte-python-cdk/pull/851

IMPORTANT: The user will expect a response posted back to the PR. You should post exactly one comment back to the respective issue PR. If the user requested a code change or PR, your comment should contain a link to the PR. Assume the user has no access to your session or conversation thread unless/until you respond back to them.

Issue #10700 by @devin-ai-integration[bot]: Redshift destination failing with empty cursor field in deduplication SQL

Issue URL: https://github.com/airbytehq/oncall/issues/10700

Please use playbook macro: !issue_fix

PLAYBOOK_md:
# `/ai-fix` Slash Command Playbook

You are AI Fix Devin, an expert at reproducing and fixing Airbyte-related issues.

## Context

You are working on the issue linked above in context. You will also need to pull issue comments for full context.

## Rule: Immediate Issue Comment After PR Creation

**MANDATORY REQUIREMENT**: If you create a PR during an AI Fix workflow, your **first action** after creating the PR must be to create a comment on the originating issue. If you cannot create a PR, likewise, your action should be to comment back to the issue.

## Properly note breaking changes

Types of breaking changes:

- spec change
  - a spec field is removed or renamed.
  - a new required spec field is added.
- schema change
  - a field is removed or renamed, or, the datatype is changed.
- stream or property removal
  - a stream is removed.
- state changes
  - the format of the state is changed.

Consult development guides for how to document in the metadata that a change is breaking (if so), and try to avoid breaking changes where necessary. Appropriate updates will also need to be made to the docs changelog and migration guide. Refer to the [Managing Breaking Changes in Connectors](https://docs.airbyte.com/platform/next/connector-development/connector-... (5704 chars truncated...)

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions github-actions bot added bug Something isn't working security labels Jan 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 7, 2026

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1767815288-fix-empty-cursor-field#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1767815288-fix-empty-cursor-field

Helpful Resources

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment

📝 Edit this welcome message.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 7, 2026

PyTest Results (Fast)

3 821 tests  +1   3 809 ✅ +1   6m 33s ⏱️ -1s
    1 suites ±0      12 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit a4a0bac. ± Comparison against base commit 49ff36e.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 7, 2026

PyTest Results (Full)

3 824 tests   3 812 ✅  10m 56s ⏱️
    1 suites     12 💤
    1 files        0 ❌

Results for commit a4a0bac.

@aaronsteers
Copy link
Copy Markdown
Member

Aaron ("AJ") Steers (aaronsteers) commented Jan 7, 2026

/prerelease

Prerelease Job Info

This job triggers the publish workflow with default arguments to create a prerelease.

Prerelease job started... Check job output.

❌ Failed to trigger prerelease workflow.
Prerelease Job Info

This job triggers the publish workflow with default arguments to create a prerelease.

Prerelease job started... Check job output.

❌ Failed to trigger prerelease workflow.


UPDATE from Aaron ("AJ") Steers (@aaronsteers):

PyPI had an outage at the time. Resolved now and CDK is now published: airbyte-cdk 7.6.2.post0.dev20801361583

@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit a67a6cf into main Jan 8, 2026
50 of 56 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the devin/1767815288-fix-empty-cursor-field branch January 8, 2026 00:48
devin-ai-integration bot added a commit to airbytehq/airbyte that referenced this pull request Jan 22, 2026
This update is part of the effort to ensure connectors include the fix
for empty cursor field handling (airbytehq/airbyte-python-cdk#875).

Related: airbytehq/oncall#11005
Parent: airbytehq/oncall#10700
Co-Authored-By: unknown <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants