You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be excellent to have support for templated parameters:
SELECT*WHEREaq.id= $assessment_question_id
FROM
assessment_questions AS aq;
Where $assessment_question_id is replaced either with:
a appropriate value for the column type
the name of the parameter in quotes
Currently, I get an error:
Error message on `0.6.1`
yarn postgrestools check apps/prairielearn/src/models/dummy.sql
apps/prairielearn/src/models/dummy.sql:1:1 syntax ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Invalid statement: syntax error at or near "$"
> 1 │ SELECT
│ ^^^^^^
> 2 │ *
> 3 │ WHERE
> 4 │ aq.id = $assessment_question_id
> 5 │ FROM
> 6 │ assessment_questions AS aq;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 │
Checked 1 file in 12ms. No fixes applied.
Found 1 error.
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Some errors were emitted while running checks
SQLFluff takes the second approach (replace the templated parameter with the name in quotes), and allows you to configure templating, as well as overriding the replacement behavior.
[sqlfluff:templater:placeholder]
param_style = dollar
assessment_question_id = 0
Default:
SELECT
*
WHERE
aq.id = 'assessment_question_id'
FROM
assessment_questions AS aq;
With customization:
SELECT
*
WHERE
aq.id = 0
FROM
assessment_questions AS aq;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
It would be excellent to have support for templated parameters:
Where
$assessment_question_id
is replaced either with:Currently, I get an error:
Error message on `0.6.1`
SQLFluff takes the second approach (replace the templated parameter with the name in quotes), and allows you to configure templating, as well as overriding the replacement behavior.
Default:
With customization:
Related:
Beta Was this translation helpful? Give feedback.
All reactions