Official website: https://www.sqlfluff.com/
Questions tagged [sqlfluff]
40 questions
11
votes
3 answers
Configure SQLFluff rules
I use SQLFluff to ensure a uniform syntax in the company and reduce error warnings before running the models in dbt. Since our syntax does not completely match the syntax of SQLFluff I would like to make some changes.
The Rules References provided…

Albin
- 822
- 1
- 7
- 25
7
votes
1 answer
SQLFluff always returns templating/parsing errors
I am trying to set up sqlfluff but for all of our queries it always returns this when running sqlfluff fix
[1 templating/parsing errors found]
Is there any way how I can force it to tell me the error that occurs? I tried running it on highes…

kober
- 289
- 5
- 12
3
votes
1 answer
How to write a custom rule in SQLFluff?
I was learning about SQLFluff and how to lint using it. While linting, it used only the default rules for checking. But our product need different customised rules for linting. So, I planned to write a custom rule in SQLFluff.
I was trying to find…

aswin sivakumar
- 31
- 2
2
votes
0 answers
SQL-FLUFF Found unparsable section '()' - Linting table_valued_function with special character in name
In my sql-script I query some data like this:
SELECT *
FROM abc.[x/y/z]()
This query works completely fine
However sqlfluff lint returns Found unparsable section '()' .
Sqlfluff parsing works fine with regular table valued functions calls without…

phlope
- 31
- 7
2
votes
1 answer
How to support Airflow jinja template in sqlfluff
I want to run sqlfluff fix command to this sql file.
This SQL is for Snowflake and will be executed in Airflow.
ti.xcom_pull is a function used in Airflow DAG.
DELETE FROM test
WHERE date = '{{ti.xcom_pull(key='filedate')}}';
then I got this…

Yohei Onishi
- 1,362
- 1
- 19
- 42
2
votes
2 answers
sqlfluff command not found
I did install sqlfluff on my mac with M1 chip using the command;
pip3 install sqlfluff==0.7.0. It went through the installation process as expected and I was able to locate .sqlfluff config file at proper location. But when I run the command…

jay
- 1,319
- 6
- 23
- 42
2
votes
1 answer
How do I fix 'unparsable' sqlfluff lint error
I am receiving the error L: 3 | P: 1 | PRS | Found unparsable section:.
This is when I am calling the date_spine macro provide by dbt_utils. Has anyone come across this before and what expected value to set in the definition of the macro in…

verrellca
- 21
- 1
- 3
1
vote
0 answers
Table to stay in the same line as FROM keyword
This should be a simple one but can't find which is the configuration option after looking at the documentation.
Example sql:
SELECT
people.id,
people.firstname,
people.lastname,
cities.name
FROM people LEFT JOIN cities ON cities.id…

iDataEngX
- 319
- 2
- 5
1
vote
0 answers
Found unparsable section: 'EXECUTE IMMEDIATE\n ...' sqlfuff?
I'm using sqlfluff to check the sql code formatting.
conf of sqlfluff are here :
sqlfluff = "^0.13.2"
[tool.sqlfluff]
sql_file_exts = [
".sql",
]
[tool.sqlfluff.core]
dialect = "bigquery"
rules =…

Chaouki
- 446
- 2
- 8
- 20
1
vote
1 answer
Render SQL Template file using sqlfluff API
Is there any way to render a sql template file using the sqlfluff API.
Currently I can render using the command:
sqlfluff render -d some_template.sql
Is there any way for me to switch from above command to python API?
(In addition, after…

Khiem Nguyen
- 11
- 1
1
vote
1 answer
Github action did not make sqlfluff linting changes to a file
I am trying to set sqlfluff linting for dbt files by following the example on this example with some slight changes. My github actions yml file looks like:
name: Run sqlfluff linter
on:
push:
branches:
- main
- sqlfluff_ga2
…

G1124E
- 407
- 1
- 10
- 20
1
vote
1 answer
`GITHUB_PULL_REQUEST_BASE_REF: parameter null or not set` error in github actions
I am getting this error while trying to set a github actions. My goal is to set up a github actions that uses another template for linting and fixing SQL. Here is my github folder.
The models folder contains a single sql file (with .sql file…

G1124E
- 407
- 1
- 10
- 20
1
vote
0 answers
tuple index out of range (sqlfluff)
I am using python 3.9.1 and have 0.3.6 sqlfluff. I do lint some files successfully and fix them however I am trying to lint 757 rows of sql file and it is giving me this error:
Traceback (most recent call last):
File…

Mincho
- 214
- 3
- 10
0
votes
0 answers
Configure SQL linter casing depending on keyword
Is it possible to configure SQLFluff to make some keywords upper case and other lower case?
upper case: SELECT, FROM, JOIN
lower case: as, on, case, when, else, end
The following snippet should be an example result.
SELECT
a,
case when b…

VV5198722
- 374
- 5
- 19
0
votes
0 answers
SQLFLUFF skips linting macro files
In the last week I've been struggling to understand why SQLFLUFF skips linting macros part of my project. The structure of my project is like this:
GCP_Project
|- models
|- macros
|- .sqlfluffignore
|- .sqlfluff
|- dbt_project.yml
|-…

Masoud
- 1
- 3