Repository navigation
Description
Type
Bug
Scope
Multi-theme or Platform
Skillset
dev ops
Description
The Lint workflow (MegaLinter) is failing on every PR. Specifically, sqlfluff reports 808 errors, all in src/queries/duckdb/. The athena queries pass. Example: https://github.com/OvertureMaps/docs/actions/runs/44366105908 (PR #622 is just a blog post).
Cause
The failures began with #612, which bumped MegaLinter from 10.1.0 to 10.2.0. That bump took sqlfluff from 4.3.0 to 4.4.0.
sqlfluff 4.4.0 added DuckDB parsing for INSTALL and LOAD (sqlfluff/sqlfluff#8438). Before that, every duckdb file failed to parse starting with the LOAD spatial line. sqlfluff then treated the whole file as one unparsable section starting on line 1. Then the -- noqa comment hid the parse error...
To reproduce:
uvx sqlfluff==4.3.0 lint --config .sqlfluff src/queries/duckdb/addresses_calgary.sql # passes
uvx sqlfluff==4.4.0 lint --config .sqlfluff src/queries/duckdb/addresses_calgary.sql # failsThe errors
Under the current src/queries/duckdb/.sqlfluff:
- 369
LT02(indentation; the files use 2-space indents) - 273
LT01(spacing, e.g.SET s3_region='us-west-2') - 21
PRSparse errors. sqlfluff 4.4.0 still can't parse DuckDBCOPY ... TO ... (FORMAT GDAL, ...)(20 files) orSET VARIABLE(1 file). - About 140 others, mostly keyword casing (
CP01) and references (RF04).
Options
These files render verbatim in the docs through raw-loader. Any reformatting or new noqa comment is visible to readers.
- Match the athena config. Exclude the same layout and style rules for duckdb, then hand-fix the rest (about 80 errors, mostly casing). Add
-- noqa: PRSto the unparsableCOPYandSET VARIABLElines. This leaves the fewest visible changes. - Run
sqlfluff fixand adopt its style (4-space indents, spacing). This produces a large visible diff in the examples. It also doesn't fix files with parse errors, so a lot of hand work remains. - Exclude
src/queries/duckdb/from sqlfluff until one of the above lands.
Acceptance criteria
- The Lint workflow passes on a PR that doesn't touch SQL.
- The DuckDB query smoke tests (
scripts/test_queries.py) still pass. They run every file insrc/queries/duckdb/against the live release.
Activity