Skip to content

Add SQL APPLY constructs - #13539

Open
cjc0013 wants to merge 1 commit into
sqlalchemy:mainfrom
cjc0013:codex/issue-5133-mssql-apply
Open

Add SQL APPLY constructs#13539
cjc0013 wants to merge 1 commit into
sqlalchemy:mainfrom
cjc0013:codex/issue-5133-mssql-apply

Conversation

@cjc0013

@cjc0013 cjc0013 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #5133.

This adds first-class CROSS APPLY and OUTER APPLY support without changing
the meaning of the existing LATERAL construct.

The new Apply object follows the lateral selectable topology and is exposed
through cross_apply() / outer_apply() constructors and corresponding
selectable methods. APPLY targets retain lateral correlation, participate in
cache-key traversal, and render as the right side of a join without an ON
clause. Direct Select inputs are coerced to subqueries, and incompatible join
criteria or join flags raise an explicit argument error.

The change includes public exports, API and tutorial documentation, an
unreleased changelog entry, and coverage for correlation, constructor and
method forms, direct Select coercion, join validation, cache-key differences,
FROM linting, and SQL Server compilation.

Validation:

  • Added 6 focused APPLY test cases; these are included in the suite totals below
  • full SQLAlchemy SQL regression suite (pytest -q test/sql): 8,327 passed,
    359 skipped
  • focused APPLY/MSSQL-related regression suites: 510 passed, 3 skipped
  • Black, zimports, flake8, and targeted mypy checks pass
  • Sphinx reports no warnings in changed documentation
    AI tools were used in preparing this change.

@sqla-tester

Copy link
Copy Markdown
Collaborator

Thanks! Issue #5133 is now marked code review in progress and no longer open for pull requests, so this pull request holds the review for it and another one won't land on top of your work. If this pull request is abandoned, a maintainer can put open for pull requests back on #5133 to reopen it to others.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add APPLY operator support for mssql

2 participants