Questions tagged [sqlfluff]

Official website: https://www.sqlfluff.com/

40 questions
0
votes
0 answers

sqlfluff newline between keywords

I am trying to configure a rule with SQLFluff that forces you not to use whitelines between keywords. This is the wrong code, which should give an error while using sqlfluff: SELECT * FROM source LEFT JOIN another_source This is the right…
Fleur Lolkema
  • 35
  • 1
  • 3
0
votes
0 answers

How can I setup a github workflow for my dbt repo with sqlfluff?

I've found a few yml files on line which work, but my sqlfluff linter passes and it shouldn't. This is my first time ever using github workflows and yml, so any advice would be great. I'm sure i'm missing somthing as to why workflow isn't using my…
0
votes
1 answer

sqlfluff: Error due to declare statement with bigquery dialect

My main issue here is that I've got an error with this code when I do a an sql lint, however I don't know how to specify to do an except for this rule in my .sqlfluff file when this is a variable from a declare statement as you can see above. Any…
aegn
  • 1
  • 1
0
votes
0 answers

Unrecoverable failure in Jinja templating: no loader for this environment specified. Have you configured your variables?

I have set up sqlfluff linter . While comiting the sql file i am getting this error Unrecoverable failure in Jinja templating: no loader for this environment specified. Have you configured your variables? …
0
votes
2 answers

Missing env variable (specified in profiles.yaml) running sqlfluff on pre-commit with dbt

I am using dbt and we set up pre-commit to lint our models before opening a PR. After the update of dbt (1.4.5 to 1.5.0) and sqlfluff (2.0.2 to 2.1.0), we are no longer able to run pre-commit because we specify environment variables in our…
Nicolaz
  • 149
  • 1
  • 8
0
votes
1 answer

Undefined jinja template variable: 'dbt_utils'

How to fix the below issue in sqlfluff linting: Undefined jinja template variable: 'dbt_utils'. I have included templater = dbt in the .sqlfluff file. Code being parsed: config( schema='business', unique_key = 'calendar_id' ) }} WITH…
Derik Roby
  • 37
  • 4
0
votes
0 answers

SQLFluff parsing error for hive alter table command

I have created a hive sql file wherein i added an alter table statement in the file. However when parsing it using sqlfluff is throwing an error - ALTER TABLE {{ params.piracy_analytics_interm_schema }}.converted_table ADD COLUMNS (COL_1…
Sri-nidhi
  • 25
  • 6
0
votes
1 answer

Is there a sqlfluff function to return the query as a string given a parsed query?

sqlfluff can generate a parsed query as a dict using the function .parse, like in the example: import json import sqlfluff print(json.dumps(sqlfluff.parse( """with cte1 as (select colA from table1), cte2 as (select colB from table2 inner join…
0
votes
0 answers

SQLfluff inline suggestions for Github Actions workflows

Hey guys I have my sqlfluff.yml file ready and it is running fine.: name: sqlfluff with reviewdog on: pull_request: jobs: test-check: name: runner / sqlfluff (github-check) runs-on: ubuntu-latest steps: - uses:…
Dude
  • 366
  • 5
  • 19
0
votes
1 answer

SQLFluff `exclude_rules` configuration ignored

I have this in my .sqlfluff, as per SQLFluff's documentation: [sqlfluff] exclude_rules = L003 When I run sqlfluff lint in the same directory where the configuration file is located, it still checks rule L003. What am I missing to exclude it?
Dominik
  • 244
  • 1
  • 3
  • 13
0
votes
0 answers

SQLFluff Lint not working for multilevel subdirectory sql file

we are trying to use SQLFluff in our project to avoid sql parser errors before deployment. in our case we have subdirectories which contains sql files. During Development we are running command sqlfluff lint command in root directory, we found that …
Arvind A
  • 77
  • 1
  • 10
0
votes
1 answer

How to enable Core-Rules in SQL-Fluff and solve TomlDecodeError?

I want to enable only the core group of rules in SQL-Fluff. So I added this line to my pyproject.toml file: [tool.sqlfluff] rules = "core" This results in the following error message: File…
0
votes
2 answers

BigQuery Code Unexpected results with code formatting sqlfluff

I have a perfect code that compares the data from one table with another (see below) which works totally fine and runs fine as well in BigQuery: with source1 as ( select b.id, b.qty, a.price from as a ,unnest
as b where…
trillion
  • 1,207
  • 1
  • 5
  • 15
0
votes
0 answers

Sqlfluff lint error COPY 'unparsable' WITH

Sqlfluff is giving me an error on this line COPY tableName FROM './var/lib/postgresql/data/short.CSV' WITH CSV QUOTE AS '"'; lint error: L: 53 | P: 73 | PRS | Line 53, Position 73: Found unparsable section: ' WITH | CSV…
Ryke
  • 51
  • 3
0
votes
0 answers

SQLFluff Dialect support for "IF NOT EXISTS"

I'm using SQLFluff to lint my queries and am getting Found unparsable section errors whenever a query contains IF NOT EXISTS. I've tried several different dialects with no success. Is it possible for SQLFluff to accept these types of queries…
Ryan Dunphy
  • 792
  • 2
  • 10
  • 33