Skip to content

Commit 2f340b6

Browse files
Bumped precommit with sqlfluff version 4.1.0 (#12243)
1 parent 6ec93d5 commit 2f340b6

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,20 @@ repos:
3333
- id: auto-walrus
3434

3535
- repo: https://github.com/sqlfluff/sqlfluff
36-
rev: 4.0.4
36+
rev: 4.1.0
3737
hooks:
3838
- id: sqlfluff-lint
3939
args: [--dialect, postgres]
4040
files: \.sql$
4141
# Rule exclusions and their rationale are documented in pyproject.toml
4242
# under [tool.sqlfluff.core].
43-
# patron_data.sql is a dev-instance fixture with synthetic test data.
44-
# import-partial.sql and prod-partial-dump.sql are auto-generated
45-
# partial-dump scripts that use psql meta-commands (\copy, \set)
46-
# which sqlfluff cannot parse.
47-
# See: https://github.com/sqlfluff/sqlfluff/issues/7512
48-
exclude: ^(scripts/dev-instance/patron_data\.sql|scripts/solr_builder/sql/(import-partial|prod-partial-dump)\.sql)$
43+
# patron_data.sql contains raw PostgreSQL COPY data rows with tab-separated
44+
# values and \N nulls which sqlfluff cannot parse.
45+
# import-partial.sql uses a psql variable placeholder (:source) in a COPY
46+
# command which sqlfluff cannot parse.
47+
# See: https://github.com/internetarchive/openlibrary/issues/12245
48+
exclude: ^(scripts/dev-instance/patron_data\.sql|scripts/solr_builder/sql/import-partial\.sql)$
49+
4950

5051
- repo: https://github.com/astral-sh/ruff-pre-commit
5152
rev: v0.15.4
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
COPY (
22
WITH modified_things AS (
3-
SELECT * FROM thing WHERE "last_modified" >= :'lo_date'
3+
SELECT *
4+
FROM thing
5+
WHERE last_modified >= :'lo_date'
46
)
57

6-
SELECT "id", "latest_revision", "data" FROM modified_things
7-
LEFT JOIN data ON "thing_id" = "id" AND "revision" = "latest_revision"
8-
) TO STDOUT;
8+
SELECT
9+
modified_things.id,
10+
modified_things.latest_revision,
11+
data.data
12+
FROM modified_things
13+
LEFT JOIN data ON modified_things.id = data.thing_id AND modified_things.latest_revision = data.revision
14+
) TO STDOUT;

0 commit comments

Comments
 (0)