Skip to content

Databricks: support INSERT BY NAME#2403

Open
finchxxia wants to merge 2 commits into
apache:mainfrom
finchxxia:dbx-insert-by-name
Open

Databricks: support INSERT BY NAME#2403
finchxxia wants to merge 2 commits into
apache:mainfrom
finchxxia:dbx-insert-by-name

Conversation

@finchxxia

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for Databricks INSERT ... BY NAME syntax.

  • Adds a by_name field to the Insert AST node.
  • Parses BY NAME for the Databricks and Generic dialects.
  • Preserves BY NAME when formatting the AST back to SQL.
  • Adds test coverage for INSERT INTO ... BY NAME with both SELECT and WITH queries.
  • Updates existing Insert AST construction sites with the default by_name: false.

Examples

INSERT INTO target BY NAME
SELECT 1 AS a;
INSERT INTO TABLE target BY NAME
WITH source AS (
    SELECT 1 AS event_data_id
)
SELECT event_data_id FROM source;

Testing

cargo test --test sqlparser_databricks test_databricks_insert_by_name
Relevant PostgreSQL INSERT regression tests

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