Skip to content

Improve SQL Beautify: use sql-formatter and support bind variables #2071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aby-jo
Copy link

@aby-jo aby-jo commented Jun 24, 2025

Fixes #2067

Summary

  • Replaces vkbeautify with sql-formatter for improved SQL formatting.
  • Adds support for bind variables (e.g., :Bind1) by replacing them with placeholders during formatting.
  • Defaults to the mysql dialect for broad compatibility.
  • Supports indentation with tabs or spaces via UI argument.

Example

Input:

INSERT INTO Table1 SELECT * FROM (SELECT :Bind1 as Field1) as new_data ON DUPLICATE KEY UPDATE Field1 = new_data.Field1;

Output

INSERT INTO
 Table1
SELECT
 *
FROM
 (
  SELECT
   :Bind1 as Field1
 ) as new_data
ON DUPLICATE KEY UPDATE
 Field1 = new_data.Field1;

@CLAassistant
Copy link

CLAassistant commented Jun 24, 2025

CLA assistant check
All committers have signed the CLA.

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.

Bug report: <Insert title here>
2 participants