Skip to content

sqlfluff 4.4.0 fails on all DuckDB example queries #623

Closed

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  # fails

The 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 PRS parse errors. sqlfluff 4.4.0 still can't parse DuckDB COPY ... TO ... (FORMAT GDAL, ...) (20 files) or SET 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.

  1. 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: PRS to the unparsable COPY and SET VARIABLE lines. This leaves the fewest visible changes.
  2. Run sqlfluff fix and 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.
  3. 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 in src/queries/duckdb/ against the live release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions