My main issue here is that I've got an error with this code when I do a an sql lint, however I don't know how to specify to do an except for this rule in my .sqlfluff file when this is a variable from a declare statement as you can see above. Any idea ?
DECLARE N INT64 DEFAULT 3;
DECLARE periode DATE DEFAULT CURRENT_DATE() - 1;
WITH article AS (
SELECT
ref.offer,
events.page_full_name AS article_name,
COUNT(events.visit_id) AS nb_visit,
RANK() OVER (
PARTITION BY ref.offer
ORDER BY COUNT(events.visit_id) DESC
) AS article_ranking
FROM `events` AS events
LEFT JOIN `reference` AS ref USING (site_id)
WHERE
events.event_day = periode
AND (
(
LOWER(events.content) LIKE "%article%"
AND ref.channel IN (
"Régions", "élèves", "La 1ère", "info"
)
)
OR (
events.page_chapter2 LIKE "%article%" AND ref.channel = "La 1ère"
)
)
GROUP BY 1, 2
)
SELECT
offer,
article_name,
nb_visit
FROM article
WHERE article.article_ranking <= N
This is my .sqlfluff code
[sqlfluff]
dialect = bigquery
exclude_rules = ST07
I couldn't find any solution to my problem.