Skip to content

fix: preserve SQLDataset filters in pandas and Arrow conversions - #1432

Open
HootRock wants to merge 1 commit into
airbytehq:mainfrom
HootRock:fix/sql-dataset-filtered-conversions
Open

HootRock wants to merge 1 commit into
airbytehq:mainfrom
HootRock:fix/sql-dataset-filtered-conversions

Conversation

@HootRock

Copy link
Copy Markdown

CachedDataset.with_filter() filters iteration and len(), but its SQLDataset conversions reload the entire stream by name. For a three-row table, with_filter("id > 1") iterates two rows while to_pandas() and to_arrow() return all three.

Execute the saved SQLAlchemy query for both conversions. Arrow reads the query in the requested chunks and reconciles compatible chunk schemas so that a first filtered batch containing only nulls does not reject later values. Whole-table CachedDataset conversion remains on its existing path.

Validation:

  • Added matching/empty-filter regressions using the real local source-test connector and DuckDB in both installer modes; all eight failed on the original code.
  • Added a nullable-first-chunk regression after independent review and observed it fail before the schema fix.
  • Focused regressions and cache neighbors: 22 passed.
  • Unit suite excluding credentialed/slow tests: 1,274 passed, 1 skipped, with test_get_time_str explicitly deselected. The unfiltered run failed only that timezone assertion; the original main-branch function reproduces the same 08:00:00 versus 00:00:00 mismatch in UTC+8.
  • Ruff checks/format, whitespace check, and full-project Pyrefly with the existing test interpreter passed.

No credentialed database integrations were run.

reviewed and tested locally.

@github-actions github-actions Bot added the community PRs from community contributors label Oct 29, 2026
@octavia-bot
octavia-bot Bot marked this pull request as draft October 29, 2026 22:23
@octavia-bot

octavia-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

Note

📝 PR Converted to Draft

More info...

Thank you for creating this PR. As a policy to protect our engineers' time, Airbyte requires all PRs to be created first in draft status. Your PR has been automatically converted to draft status in respect for this policy.

As soon as your PR is ready for formal review, you can proceed to convert the PR to "ready for review" status by clicking the "Ready for review" button at the bottom of the PR page.

To skip draft status in future PRs, please include [ready] in your PR title or add the skip-draft-status label when creating your PR.

@github-actions

Copy link
Copy Markdown

👋 Welcome to PyAirbyte!

Thank you for your contribution from HootRock/PyAirbyte! We're excited to have you in the Airbyte community.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/HootRock/PyAirbyte.git@fix/sql-dataset-filtered-conversions' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/HootRock/PyAirbyte.git@fix/sql-dataset-filtered-conversions'

PR Slash Commands

As needed or by request, Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
  • /evals - Runs the Cloud MCP evals that use the MCP tools this PR changed (/evals full=true runs the full suite)
📚 Show Repo Guidance

Helpful Resources

If you have any questions, feel free to ask in the PR comments or join our community:

📝 Edit this welcome message.

@HootRock
HootRock marked this pull request as ready for review October 29, 2026 22:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community PRs from community contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant