You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever a project name contains a dash followed by a number then it is being interpreted as a minus number value and being separated when formatted. This is troublesome for us as a lot of our project names contain this format and the formatter is breaking our queries as a result.
We can't always rely on escaping the project name as these queries are written by end users in the browser.
Input data
-- BigQueryselect*from project-12345.table.column
Expected Output
select*from
project-12345.table.column
Actual Output
select*from
project -12345.table.column
Usage
What SQL language(s) does this apply to?
BigQuery
Which SQL Formatter version are you using?
15.4.5
The text was updated successfully, but these errors were encountered:
Unfortunately this is a problem that's pretty much impossible to fix with the current architecture of SQL Formatter. This is because foo-bar.baz.zap would have to be treated differently based on the context:
when inside a FROM-clause it needs to be parsed as project-name.table.column.
when inside some expression it needs to be parsed as identifier - identifer.field.field.
SQL Formatter doesn't properly parse the SQL, so it can't really tell when it should treat it in one or the other way. I guess one option would be to always parse such constructs as project-name, as this way the formatter would avoid introducing syntax errors.
Anyway... Because of problems like that I created another SQL formatting tool prettier-plugin-sql-cst which does have a pretty solid BigQuery support and it does not suffer from issues like this. I suggest you give it a try.
PS. Just FYI, when reporting bugs to this or any other open-source project, please don't answer "latest" when asked which version number you're using. That "latest" will no more be the latest version when somebody looks at this bug report a year from now. Or I might have released a new version just minutes ago, and would not have any idea whether your definition of "latest" refers to that version or some earlier one.
PS. Just FYI, when reporting bugs to this or any other open-source project, please don't answer "latest" when asked which version number you're using. That "latest" will no more be the latest version when somebody looks at this bug report a year from now. Or I might have released a new version just minutes ago, and would not have any idea whether your definition of "latest" refers to that version or some earlier one.
That makes total sense. Apologies I wrote it in a hurry.
Whenever a project name contains a dash followed by a number then it is being interpreted as a minus number value and being separated when formatted. This is troublesome for us as a lot of our project names contain this format and the formatter is breaking our queries as a result.
We can't always rely on escaping the project name as these queries are written by end users in the browser.
Input data
Expected Output
Actual Output
Usage
BigQuery
15.4.5
The text was updated successfully, but these errors were encountered: