Skip to content

Support for SQLFluff with dbt cloud / dbt cloud CLI #1581

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
1 task
MalteNiederstadt opened this issue Feb 18, 2025 · 0 comments
Open
1 task

Support for SQLFluff with dbt cloud / dbt cloud CLI #1581

MalteNiederstadt opened this issue Feb 18, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@MalteNiederstadt
Copy link

Describe the feature

🚀 Feature Request: Add sqlfluff lint and sqlfluff fix Commands for the Current File in VSCode

Summary

Enable the ability to run sqlfluff lint and sqlfluff fix directly from the dbt Power User extension for the currently opened SQL file, without manually retrieving the file path.

Motivation

While sqlfluff has been available for the dbt cloud CLI for a while, running it manually requires specifying the file path each time. This feature would provide a seamless, one-click way to lint and fix SQL files directly within VSCode, improving workflow efficiency for dbt developers.

Proposed Solution

  • Add new VSCode commands to:
    • Lint the currently open file: Run dbt sqlfluff lint <current-file> automatically.
    • Fix the currently open file: Run dbt sqlfluff fix <current-file> automatically.
    • Lint the entire dbt project or a selected folder: Run dbt sqlfluff lint <selected-path>.
    • Fix all SQL files in a selected folder: Run dbt sqlfluff fix <selected-path>.
  • Integrate these commands into the VSCode command palette for quick access.

Additional Context

  • This feature is primarily a convenience improvement, reducing the need to manually determine file paths before running linting or formatting commands.
  • Reference: dbt Cloud CLI SQL Linting

Describe alternatives you've considered

Currently, the alternative is to manually run dbtsqlfluff lint or dbt sqlfluff fix from the terminal, which requires finding the full path of the SQL file or specifying the directory. While functional, this adds unnecessary friction, especially for quick linting and formatting during development.

Another workaround is using a general-purpose VSCode task or script, but this lacks direct integration with the dbt Power User extension and does not provide native command palette access or inline problem reporting.

Who will benefit?

This feature will benefit dbt developers and analytics engineers who work with SQL models in dbt projects. Specifically:

  • dbt Developers: Quickly lint and fix SQL files without leaving VSCode, improving workflow efficiency.
  • Data Engineers: Maintain consistent SQL formatting across projects without manually specifying file paths.
  • Teams with SQL Style Guidelines: Organizations enforcing SQL style conventions using sqlfluff can integrate this into daily development without relying on external scripts or manual checks.

This will streamline development and reduce friction when working with dbt projects in VSCode.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@MalteNiederstadt MalteNiederstadt added the enhancement New feature or request label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant