-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[add] sql-formatter params #6724
Open
ko-ya346
wants to merge
13
commits into
getredash:master
Choose a base branch
from
ko-ya346:add/sql-formatter-params
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bfa9c26
[change] sql-formatter version
ko-ya346 daf00ab
[add] sql-formatter config
ko-ya346 bd0eef0
[update] sql-formatter
ko-ya346 55ce747
refuctoring
ko-ya346 8daccf7
refuctoring
ko-ya346 4b7e2ce
[fix] set paramsType for the format of the query, including query par…
ko-ya346 fbac96b
Restyled by prettier
restyled-commits 9515714
[del] @types/sql-formatter
ko-ya346 0fa7c46
upgrade typescript
ko-ya346 3e11242
[add] .\s- -> paramTypes:custom
ko-ya346 55ce8eb
[change] typescript
ko-ya346 9d128c4
[change] formatterConfig .js -> .json
ko-ya346 7471d9a
[add] referrence sql-formatter
ko-ya346 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"paramTypes": { | ||
"custom": [{ | ||
"regex": "\\{\\{[a-zA-Z0-9\\s\\._-]+\\}\\}" | ||
}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"language": "bigquery", | ||
"dialect": "bigquery", | ||
"tabWidth": 4, | ||
"keywordCase": "upper", | ||
"dataTypeCase": "upper", | ||
"functionCase": "upper" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI the main reason we had a custom
sql-formatter
maintained in getredash/sql-formatter is due to the lack of support to the parameters syntax ({{}}
). Previously it would just add line breaks, breaking the query text, with this version it seems to throw an error when a query has themThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabrieldutra
Thanks for the review.
The commit below eliminates the error that occurs when formatting is executed when query parameters are included.
Specifically, we specified {{}} in the paramTypes argument.
dabd3ed
I used this link as a reference.
https://github.com/sql-formatter-org/sql-formatter/blob/HEAD/docs/paramTypes.md