Skip to content

Allow more shell-style redirects with /source - #2202

Merged
rolandwalker merged 1 commit into
mainfrom
RW/allow-all-source-hybrid-redirects
Sep 5, 2026
Merged

Allow more shell-style redirects with /source#2202
rolandwalker merged 1 commit into
mainfrom
RW/allow-all-source-hybrid-redirects

Conversation

@rolandwalker

Copy link
Copy Markdown
Contributor

Description

Previously

/source "filename.sql" $> output.csv;

would only work if "filename.sql" was quoted, due to a quirk in how we approach detection of valid SQL on the left-hand-side using sqlglot.

With this change, we allow any /source expression on the LHS of a shell-style redirect operator.

The key change is a quite small addition to hybrid_redirection.py, but requires reorganizing several methods to avoid a circular import.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

Previously

    /source "filename.sql" $> output.csv;

would only work if "filename.sql" was quoted, due to a quirk in how
we approach detection of valid SQL on the left-hand-side using sqlglot.

With this change, we allow any /source expression on the LHS of a
shell-style redirect operator.

The key change is a quite small addition to hybrid_redirection.py, but
requires reorganizing several methods to avoid a circular import.
@rolandwalker rolandwalker self-assigned this Sep 5, 2026
@rolandwalker
rolandwalker merged commit 2de1c7d into main Sep 5, 2026
11 checks passed
@rolandwalker
rolandwalker deleted the RW/allow-all-source-hybrid-redirects branch September 5, 2026 11:22
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.

1 participant