The BigQuery SQL Formatter extension for Visual Studio Code provides syntax checking and formatting for BigQuery SQL queries. This extension aims to enhance the development experience for users working with BigQuery by offering features such as:
- Syntax Checking: Automatically checks the syntax of BigQuery SQL queries to ensure they are correct and conform to best practices.
- Formatting: Provides tools to format SQL queries according to predefined styles, making the code more readable and maintainable.
- Language Server Integration: Utilizes a language server to offer real-time feedback and suggestions as users write SQL queries.
- Support for Multiple SQL Dialects: While aimed at BigQuery use, the extension supports various SQL dialects, including standard SQL and GoogleSQL, ensuring compatibility with different BigQuery environments.
- Best Practices Enforcement: Encourages the use of best practices in SQL query writing, such as preferring LEFT JOIN over RIGHT JOIN for better readability and maintainability.
This extension is particularly useful for developers and data analysts who frequently write and maintain BigQuery SQL queries, providing them with tools to improve code quality and productivity.
Add the following to your settings.json
.
"[googlesql]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
},
To disable all rules for a line add comment -- noqa
.
select case when cc.enddate is null then 1 else null end as is_current -- noqa
from dataset.table cc;
To disable specific rules for a line add comment -- noqa
followed by a comma separated list of rules.
select case when cc.enddate is null then 1 else null end as is_current -- noqa: ST01
from dataset.table cc;