Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow selective disabling of rules per query #3619

Open
rhodeon opened this issue Sep 28, 2024 · 0 comments · May be fixed by #3620
Open

Allow selective disabling of rules per query #3619

rhodeon opened this issue Sep 28, 2024 · 0 comments · May be fixed by #3620

Comments

@rhodeon
Copy link

rhodeon commented Sep 28, 2024

What do you want to change?

Currently, the only way to disable the vetting of rules for a query is with the @sqlc-vet-disable flag.
The problem with this is that it is an "all-or-nothing" approach. When provided, that flag disables the vetting of all rules for the query including some which might be needed.
It would be good to be able to provide a list of rules to skip, like:

/* @sqlc-vet-disable sqlc/db-prepare no-exec */

In this case, only the 2 listed rules in the comment would be skipped, but all others would run.
When no rule is provided, the flag should disable all rules in the query, just like the current behaviour, for backwards-compatibility.

Use Case

I have a basic no-delete-without-where rule which needs to be disabled for a few queries, but the current way to do that involves skipping all rules for the affected queries.

What database engines need to be changed?

PostgreSQL, MySQL, SQLite

What programming language backends need to be changed?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant