I experience this issue when running SQLFluff with dbt adapter dbt-postgres
through pre-commit.
My .pre-commit-config.yaml
:
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.2.5
hooks:
- id: sqlfluff-lint
additional_dependencies : ['dbt-postgres==1.8.2', 'sqlfluff-templater-dbt==3.2.5']
The resulting error:
sqlfluff-lint............................................................Failed
- hook id: sqlfluff-lint
- exit code: 1
WARNING Exact file path macros/calculate_days_past_due.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/delete_fivetran_deleted_rows.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/delete_orphaned_tables.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/generate_schema_name.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/get_beehive_base_url.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/get_current_date_or_yesterday.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/get_max_datetime_in_utc.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/get_outstanding_bucket_id.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/get_performance_stage_id.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/get_return_on_equity_percentage.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path macros/safe_divide.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
WARNING Exact file path tests/generic/aggregration_in_range.sql was given but it was ignored by an ignore pattern set in .sqlfluffignore, re-run with `--disregard-sqlfluffignores` to not process ignore files.
=== [dbt templater] Sorting Nodes...
Traceback (most recent call last):
File "/app/.cache/repofkjpzydp/py_env-python3.11/bin/sqlfluff", line 8, in <module>
sys.exit(cli())
^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/sqlfluff/cli/commands.py", line 653, in lint
result = lnt.lint_paths(
^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/sqlfluff/core/linter/linter.py", line 1080, in lint_paths
for i, linted_file in enumerate(runner.run(expanded_paths, fix), start=1):
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/sqlfluff/core/linter/runner.py", line 147, in run
for lint_result in self._map(
File "/usr/local/lib/python3.11/multiprocessing/pool.py", line 873, in next
raise value
File "/usr/local/lib/python3.11/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/multiprocessing/pool.py", line 144, in _helper_reraises_exception
raise ex
^^^^^^^
File "/usr/local/lib/python3.11/multiprocessing/pool.py", line 391, in _guarded_task_generation
for i, x in enumerate(iterable):
^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/sqlfluff/core/linter/runner.py", line 65, in iter_partials
for fname, rendered in self.iter_rendered(fnames):
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/sqlfluff/core/linter/runner.py", line 48, in iter_rendered
for fname in self.linter.templater.sequence_files(
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/sqlfluff_templater_dbt/templater.py", line 460, in sequence_files
self.profiles_dir = self._get_profiles_dir()
^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/sqlfluff_templater_dbt/templater.py", line 380, in _get_profiles_dir
from dbt.cli.resolvers import default_profiles_dir
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/cli/__init__.py", line 1, in <module>
from .main import cli as dbt_cli # noqa
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/cli/main.py", line 14, in <module>
from dbt.cli import requires, params as p
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/cli/requires.py", line 9, in <module>
from dbt.context.providers import generate_runtime_macro_context
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/context/providers.py", line 26, in <module>
from dbt.config import RuntimeConfig, Project
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/config/__init__.py", line 3, in <module>
from .project import Project, IsFQNResource, PartialProject # noqa
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/config/project.py", line 35, in <module>
from dbt.graph import SelectionSpec
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/graph/__init__.py", line 1, in <module>
from .selector_spec import ( # noqa: F401
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/graph/selector_spec.py", line 9, in <module>
from .selector_methods import MethodName
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/graph/selector_methods.py", line 11, in <module>
from dbt.contracts.graph.manifest import Manifest
^^^^^^^^^^^^^^^^^
File "/app/.cache/repofkjpzydp/py_env-python3.11/lib/python3.11/site-packages/dbt/contracts/graph/manifest.py", line 786, in <module>
class Manifest(MacroMethods, DataClassMessagePackMixin, dbtClassMixin):
^^^^^^^^^^^^^^^^^
TypeError: Cannot create a consistent method resolution
order (MRO) for bases object, DataClassMessagePackMixin, dbtClassMixin