sqlfluff / sqlfluff

A modular SQL linter and auto-formatter with support for multiple dialects and templated code.
https://www.sqlfluff.com
MIT License
7.31k stars 648 forks source link

Sqlfluff Incompatible with latest release of dbt-core #5845

Closed bburner closed 4 weeks ago

bburner commented 4 weeks ago

Search before asking

What Happened

When running sqlfluff lint with the latest version of dbt-core, the following error occurs: ImportError: cannot import name 'read_user_config' from 'dbt.config'. I have confirmed this is an issue with the latest release of dbt-core v1.7.14.

Expected Behaviour

sqlfluff lints successfully

Observed Behaviour

A Python ImportError occurs.

How to reproduce

ensure you have the latest versions of the following:

dbt-snowflake sqlfluff sqlfluff-templater-dbt

ensure the latest version of dbt-core is installed (1.7.14). If you have an existing installation, dbt-snowflake might use this, so it's best to run python -m pip uninstall dbt-core before installing the above packages. This issue only occurs with 1.7.14.

once you've verified the above is installed, run sqlfluff lint on any file to reproduce the error

Dialect

snowflake

Version

3.0.5

Configuration

--.sqlfluff file: [sqlfluff] templater = dbt dialect = snowflake rules = core, L019 max_line_length = 120 [sqlfluff:layout:type:comma] line_position = leading [sqlfluff:layout:type:alias_expression] spacing_before = align align_within = select_clause align_scope = statement [sqlfluff:rules:capitalisation.keywords] capitalisation_policy = lower [sqlfluff:rules:capitalisation.identifiers] extended_capitalisation_policy = upper [sqlfluff:rules:aliasing.length] min_alias_length = 3

--.sqlfluffignore file: target/

dbt <1.0.0

dbt_modules/

dbt >=1.0.0

dbt_packages/ macros/

Are you willing to work on and submit a PR to address the issue?

Code of Conduct

greg-finley commented 4 weeks ago

dupe of https://github.com/sqlfluff/sqlfluff/issues/5841