Between yesterday and today something changed and ...
# troubleshooting
j
Between yesterday and today something changed and running SQLFluff is breaking. When I run this
meltano invoke sqlfluff:fix
I'm getting the following failure. It doesn't look like SQLFluff released anything overnight. Anyone know what could be going on? thanks!
Copy code
(.venv) ➜  etl git:(main) ✗ meltano invoke sqlfluff:fix
2023-06-23T08:47:00.603999Z [info     ] Environment 'dev' is active
==== finding fixable violations ====
=== [dbt templater] Sorting Nodes...                                                                                                                                                                            
file /Users/jacob/code/miga/analytics/etl/transform/models/healthie/clinical_program_rosters/stg_hypertension_program_membership.sql:   0%|                                              | 0/13 [00:00<?, ?it/s]08:47:07  Registered adapter: bigquery=1.5.3
=== [dbt templater] Compiling dbt project...                                                                                                                                                                    
=== [dbt templater] Project Compiled.                                                                                                                                                                           
file /Users/jacob/code/miga/analytics/etl/transform/models/healthie/clinical_program_rosters/stg_hypertension_program_membership.sql:   0%|                                              | 0/13 [00:00<?, ?it/s]Traceback (most recent call last):
  File "/Users/jacob/code/miga/analytics/etl/.meltano/utilities/sqlfluff/venv/bin/sqlfluff", line 8, in <module>
    sys.exit(cli())
... removed some stack trace lines ...
  File "/Users/jacob/code/miga/analytics/etl/.meltano/utilities/sqlfluff/venv/lib/python3.10/site-packages/sqlfluff_templater_dbt/templater.py", line 404, in <listcomp>
    results = [self.dbt_manifest.expect(uid) for uid in selected]
  File "/Users/jacob/code/miga/analytics/etl/.meltano/utilities/sqlfluff/venv/lib/python3.10/site-packages/dbt/graph/selector_methods.py", line 329, in search
    root = Path(cv_project_root.get())
LookupError: <ContextVar name='project_root' at 0x107f3b420>
here's what my config looks like in
meltano.yml
Copy code
utilities:
  - name: sqlfluff
    variant: sqlfluff
    pip_url: sqlfluff~=2.1.0 sqlfluff-templater-dbt dbt-core dbt-bigquery
    settings:
    - name: DBT_BIGQUERY_PROJECT
      env: DBT_BIGQUERY_PROJECT
      value: analytics-prod-383519

    - name: DBT_BIGQUERY_AUTH_METHOD
      env: DBT_BIGQUERY_AUTH_METHOD
      value: ${DBT_BIGQUERY_AUTH_METHOD}

    - name: DBT_BIGQUERY_DATASET
      env: DBT_BIGQUERY_DATASET
      value: ${DBT_BIGQUERY_DATASET}
Sharing here just incase anyone's having he same issue, this issue has been reported on the SQLFluff repo and this worked for me.