Repository navigation
fix(lint): lint DuckDB queries under sqlfluff 4.4.0 - #624
Merged
Adam Lastowka (Rachmanin0xFF) merged 1 commit intoNov 18, 2026
Merged
Conversation
MegaLinter 10.2.0 ships sqlfluff 4.4.0, which parses DuckDB LOAD and INSTALL. Before that, every DuckDB query failed to parse on line 1 and the -- noqa on that line hid it, so no rules ran. Now they all run. - Match the athena exclude list, and also exclude AM09, AL03, AM03 and CP04. ST06 stays excluded because it reorders SELECT output. - Lowercase functions (except CAST) and uppercase keywords. - Drop the dead noqa comments on LOAD and INSTALL lines. - Mark COPY ... WITH (FORMAT GDAL) and SET VARIABLE lines with -- noqa: PRS, since sqlfluff still can't parse them. - Replace CASE null checks with coalesce in places_conflating_OSM.sql. - test_queries.py skips comment-only fragments after a semicolon, so a trailing -- noqa: PRS doesn't turn a query into a script. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Adam Lastowka <adamlastowka@gmail.com>
🗺️ Overture Docs preview is live!
Note ♻️ This preview updates automatically with each push to this PR. |
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
Adam Lastowka (Rachmanin0xFF)
marked this pull request as ready for review
November 18, 2026 18:42
Adam Lastowka (Rachmanin0xFF)
requested a review
from a team
as a code owner
November 18, 2026 18:42
John McCall (lowlydba)
approved these changes
Nov 18, 2026
John McCall (lowlydba)
left a comment
Contributor
There was a problem hiding this comment.
beautiful 🎨
Adam Lastowka (Rachmanin0xFF)
deleted the
rachmanin0xff-fix-sqlfluff-lint-failures
branch
November 18, 2026 18:43
Adam Lastowka (Rachmanin0xFF)
temporarily deployed
to
staging
November 18, 2026 18:43 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the DuckDB SQLFluff compatibility updates and smoke-test statement-splitter changes.
No open issues 🎉
What changed in this PR
Addresses #623 by adapting the documentation’s DuckDB examples to SQLFluff 4.4.0, introduced by the MegaLinter upgrade in #612.
Changes:
- Adjusts DuckDB lint rules while preserving SELECT column order and existing layout.
- Removes obsolete suppressions, standardizes SQL formatting, and adds targeted suppressions for unsupported syntax.
- Updates the smoke-test statement splitter to ignore comment-only fragments.
| File | Description |
|---|---|
src/queries/duckdb/write_geoparquet.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/transportation_routes.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/transportation_parking.sql |
Removes suppressions; uses leading AND. |
src/queries/duckdb/segment_bbox.sql |
Removes suppressions; uses leading AND. |
src/queries/duckdb/seattle_water_for_map.sql |
Normalizes keyword casing; targets GDAL suppression. |
src/queries/duckdb/seattle_roads_for_map.sql |
Replaces LOAD suppression with GDAL suppression. |
src/queries/duckdb/seattle_places_for_map.sql |
Normalizes casing and AND placement; suppresses GDAL parsing. |
src/queries/duckdb/seattle_placenames_for_map.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/seattle_land_use_for_map.sql |
Replaces LOAD suppression with GDAL suppression. |
src/queries/duckdb/seattle_land_for_map.sql |
Replaces LOAD suppression with GDAL suppression. |
src/queries/duckdb/seattle_buildings_for_map.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/rome_places.sql |
Removes self-alias; adjusts AND placement and suppressions. |
src/queries/duckdb/places.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/places_wawa.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/places_mountains.sql |
Removes LOAD suppression; adds final newline. |
src/queries/duckdb/places_mills.sql |
Removes suppressions; normalizes alias casing. |
src/queries/duckdb/places_in_buildings.sql |
Normalizes DISTINCT syntax and keyword casing. |
src/queries/duckdb/places_conflating_OSM.sql |
Replaces null-check CASE expressions with coalesce; cleans up SQL. |
src/queries/duckdb/places_confidence.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/paris_roads_intersecting.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/paris_roads_contained.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/new_york_pizza.sql |
Removes self-alias; normalizes casing and suppressions. |
src/queries/duckdb/mountain_peaks.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/lithuania_places.sql |
Removes suppressions; normalizes alias casing. |
src/queries/duckdb/hyderabad_buildings.sql |
Replaces LOAD suppression with GDAL suppression. |
src/queries/duckdb/gers_registry_lookup_id.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_registry_file_path.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_registry_fetch_feature.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_registry_check_matched_ids.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_divisions_hierarchy.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_divisions_hierarchy_areas.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/gers_churn_by_change_type.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_bridge_meta_places_facebook.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_bridge_buildings_multi_source.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/gers_bridge_buildings_by_source.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/divisions_subtype_counts_specific_countries.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/divisions_query_specific_feature.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/divisions_philly_places.sql |
Removes suppressions; lowercases function names. |
src/queries/duckdb/divisions_lookup_osm.sql |
Removes suppressions; uppercases LIKE. |
src/queries/duckdb/divisions_is_territorial_true.sql |
Normalizes casing; targets GDAL suppression. |
src/queries/duckdb/divisions_is_land_true.sql |
Normalizes casing; targets GDAL suppression. |
src/queries/duckdb/divisions_division_counts.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/divisions_division_area_counts.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/divisions_denmark_locality_neighborhood.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/divisions_counts_per_type.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/divisions_counts_per_entity.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/divisions_boundary_counts.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/divisions_border_usmx.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/county_level_geometries.sql |
Replaces LOAD suppression with GDAL suppression. |
src/queries/duckdb/changelog_places_feature_by_change_type.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/changelog_places_churn.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/buildings_in_division_area.sql |
Replaces extension suppressions with SET VARIABLE suppression. |
src/queries/duckdb/buildings_detroit.sql |
Normalizes alias casing; targets GDAL suppression. |
src/queries/duckdb/base_transit_rome.sql |
Removes LOAD suppression; adds final newline. |
src/queries/duckdb/base_transit_counts.sql |
Removes LOAD suppression; adds final newline. |
src/queries/duckdb/base_land_mountains.sql |
Removes obsolete LOAD suppression. |
src/queries/duckdb/addresses_utah.sql |
Removes extension suppressions; lowercases st_within. |
src/queries/duckdb/addresses_to_parquet.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/addresses_nz_export.sql |
Replaces LOAD suppressions with GDAL suppression. |
src/queries/duckdb/addresses_counts.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/addresses_calgary.sql |
Removes obsolete LOAD suppressions. |
src/queries/duckdb/.sqlfluff |
Expands rule exclusions; sets lowercase functions except CAST. |
scripts/test_queries.py |
Ignores comment-only fragments when splitting statements. |
Review effort: Balanced
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pull Request
Fixes #623
MegaLinter 10.2.0 (#612) ships sqlfluff 4.4.0, which can parse DuckDB
LOADandINSTALL. Before that, every DuckDB query failed to parse on the first line, and they all had-- noqaat the top to avoid that.This PR removes the
-- noqalines (mostly) and fixes formatting to comply with the linting rules on all SQL examples.Changes
src/queries/duckdb/.sqlfluff: match the athena exclude list. Also exclude AM09, AL03, AM03 and CP04. ST06 stays excluded because it reorders SELECT columns, which changes query output. Functions are lowercase, exceptCAST.AND, drop self-aliases, add trailing newlines.-- noqacomments onLOAD/INSTALLlines.-- noqa: PRSto the lines sqlfluff still can't parse:COPY ... WITH (FORMAT GDAL, ...)andSET VARIABLE.places_conflating_OSM.sql: replace fourCASEnull checks withcoalesce(...)(ST02).places_in_buildings.sql:DISTINCT(buildings.id)becomesDISTINCT buildings.id.scripts/test_queries.py: skip comment-only fragments after a;. Without this, a trailing; -- noqa: PRSturns a single query into a multi-statement script.Testing
uvx sqlfluff==4.4.0 lint --config .sqlfluff src/queries: passed, no violations.python scripts/test_queries.py --dry-run: passed, all 62 files prepared.main: all 62 files are classified the same way (query vs. script), and DuckDB parses every statement.