Skip to content

sean-conkie/BigQuerySQLFormatter-extension

Repository files navigation

BigQuery SQL Formatter

Documentation Status Lint Code Base CodeQL Node.js Test codecov

VS Code extension providing BigQuery SQL syntax checking

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.

Configuration

Fix on save

Add the following to your settings.json.

  "[googlesql]": {
    "editor.codeActionsOnSave": {
      "source.fixAll": "explicit"
    }
  },

Disable Rules

In-line directive

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;
image

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;
image