Skip to content

feat: support Databricks single-line magics (6999) - #4244

Open
benfdking wants to merge 1 commit into
port/sqlfluff-6996from
port/sqlfluff-6999
Open

benfdking wants to merge 1 commit into
port/sqlfluff-6996from
port/sqlfluff-6999

Conversation

@benfdking

Copy link
Copy Markdown
Collaborator

Stacked on sqruff #4243. Merge #4243 first.
#4243

Summary

  • Support Databricks single-line notebook magics such as %run ./Notebook, alongside multiline magic cells.
  • Port the upstream notebook fixture and parse tree; retain the existing Rust object-reference wrapper in table references.

Ported from SQLFluff 163858bee800fcaf18e9b98f99b22cdfa72026ac
sqlfluff/sqlfluff#6999
sqlfluff/sqlfluff@163858b

Validation

  • cargo fmt --all -- --check
  • cargo build
  • cargo test
  • bazel test //... --test_timeout=600,300,900,3600 --local_test_jobs=1 --lockfile_mode=off

Ported from SQLFluff 163858bee800fcaf18e9b98f99b22cdfa72026ac
sqlfluff/sqlfluff#6999
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-15T11:14:34.038634Z 150876f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@benfdking
benfdking added this pull request to stack #4155 September 15, 2026 11:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 150876fb61

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

),
Matcher::regex(
"magic_single_line",
r"(-- MAGIC %)([^\n]{2,})( [^%]{1})([^\n]*)",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match one-character magic names

Databricks supports the %r language magic, but the {2,} requirement prevents inputs such as -- MAGIC %r 1+1 from becoming MagicSingleLine. With a trailing newline they instead match magic_start, which consumes that newline and leaves only one newline before -- COMMAND ----------, so the command delimiter matcher no longer recognizes the next cell boundary; at EOF the line falls through to a regular comment entirely. Allow the command portion to contain a single character.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark for ea928ee

Click to view benchmark
Test Base PR %
DepthMap::from_parent 116.9±0.90µs 117.0±4.86µs +0.09%
fix_complex_query 25.8±0.34ms 26.8±0.37ms +3.88%
fix_superlong 87.0±3.33ms 90.5±5.12ms +4.02%
parse_complex_query 4.2±0.06µs 4.3±0.10µs +2.38%
parse_expression_recursion 7.3±0.08µs 7.5±0.16µs +2.74%
parse_simple_query 1039.3±11.39ns 1048.4±9.38ns +0.88%

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