diff --git a/website/docs/docs/cloud/configure-cloud-cli.md b/website/docs/docs/cloud/configure-cloud-cli.md index 2d4bdcb639d..17fade3d3a7 100644 --- a/website/docs/docs/cloud/configure-cloud-cli.md +++ b/website/docs/docs/cloud/configure-cloud-cli.md @@ -110,17 +110,34 @@ As a tip, most command-line tools have a `--help` flag to show available command - `dbt run --help`: Lists the flags available for the `run` command ::: -### SQLFluff integration -The dbt Cloud CLI supports [SQLFluff](https://sqlfluff.com/), a modular and configuration SQL linter, which warns you of complex functions, syntax, formatting, and compilation errors. +### Lint SQL files -To get started, run `dbt sqlfluff -h` to see the list of supported commands and flags, such as `dbt sqlfluff lint` to lint SQL files. +From the dbt Cloud CLI, you can invoke [SQLFluff](https://sqlfluff.com/) which is a modular and configurable SQL linter that warns you of complex functions, syntax, formatting, and compilation errors. Many of the same flags that you can pass to SQLFluff are available from the dbt Cloud CLI. + +The available SQLFluff commands are: + +- `lint` — Lint SQL files by passing a list of files or from standard input (stdin). +- `fix` — Fix SQL files. +- `format` — Autoformat SQL files. + + +To lint SQL files, run the command as follows: + +```shell +dbt sqlfluff lint [PATHS]... [flags] +``` + +When no path is set, dbt lints all SQL files in the current project. To lint a specific SQL file or a directory, set `PATHS` to the path of the SQL file(s) or directory of files. To lint multiple files or directories, pass multiple `PATHS` flags. + +To show detailed information on all the dbt supported commands and flags, run the `dbt sqlfluff -h` command. #### Considerations -Keep the following points in mind when using SQLFluff with the dbt Cloud: -- When you run `dbt sqlfluff`, it picks up changes to your local .sqlfluff config. -- To use SQLFluff in continuous integration/continuous development, you need to have a `dbt_cloud.yml` file in your project and run commands from a valid dbt project. -- SQLFluff commands in the dbt Cloud CLI do not return exit codes yet. +When running `dbt sqlfluff` from the dbt Cloud CLI, the following are important behaviors to consider: + +- dbt reads the `.sqlfluff` file, if it exists, for any custom configurations you might have. +- For continuous integration/continuous development (CI/CD) workflows, your project must have a `dbt_cloud.yml` file and you have successfully run commands from within this dbt project. +- An SQLFluff command will return an exit code of 0 if it ran without any file violations. This dbt behavior differs from SQLFluff behavior, where a linting violation returns a non-zero exit code. dbt Labs plans on addressing this in a later release. ## FAQs diff --git a/website/docs/docs/dbt-versions/release-notes.md b/website/docs/docs/dbt-versions/release-notes.md index ea3f1646ca8..5ce0c210b95 100644 --- a/website/docs/docs/dbt-versions/release-notes.md +++ b/website/docs/docs/dbt-versions/release-notes.md @@ -19,6 +19,7 @@ Release notes are grouped by month for both multi-tenant and virtual private clo [^*] The official release date for this new format of release notes is May 15th, 2024. Historical release notes for prior dates may not reflect all available features released earlier this year or their tenancy availability. ## July 2024 +- **New**: The ability to lint your SQL files from the dbt Cloud CLI is now available. To learn more, refer to [Lint SQL files](/docs/cloud/configure-cloud-cli#lint-sql-files). - **New**: Introduced Semantic validations in CI pipelines. Automatically test your semantic nodes (metrics, semantic models, and saved queries) during code reviews by adding warehouse validation checks in your CI job using the `dbt sl validate` command. You can also validate modified semantic nodes to guarantee code changes made to dbt models don't break these metrics. Refer to [Semantic validations in CI](/docs/deploy/ci-jobs#semantic-validations-in-ci) to learn about the additional commands and use cases. ## June 2024