Replacing Redgate regex rules with SQLFluff rules
Published 16 January 2026
We've been working on creating SQLFluff alternatives for our custom regex-based SQL linting rules. This will help us leverage the capabilities of SQLFluff for better SQL code quality and consistency.
- SQLFluff is more than just simple text pattern matching (so for example, commented-out SQL won't trip it up like it would Regex)
- You can configure your rules in one place (the
sqlfluff.cfgfile) - You can manage rule exceptions in a more fine-grained manner using SQLFLuff's
noqamechanism - It's supports many more dialect variants so it's likely to do a better job on less common DBs out of the box
- Many SQLFluff rules have configuration options to make it easier to customize to your requirements via configuration rather than rewriting the rule
The engine that powers regex rules will remain and customers can continue to use it however we don't plan to release new rules in this format.
When will anything change ?
We will stop shipping our regex rules (the .toml files in the rules/ folder of each Flyway release) in the near future.
If you were relying on them being in the Flyway installation then this will change. If you have your own copies then nothing will change - we're not removing the ability to use regex rules, just stopping shipping these ones.
We have already been shipping the replacement SQLFLuff rules so you may have noticed duplicate alerts from the regex and SQLFluff engines.
How to change over
As you are using Regex rules then you have an Enterprise license and so also have access to the bundled version of SQLFluff that includes Redgate's rules.
You will need to configure SQLFLuff to apply the rules that you are interested in.
- Identify the replacement rule you need to use (see the table below)
- Copy the
conf/sqlfluff.cfgfile from the Flyway installation into your project - this configuration is your definition of what good SQL looks like to your organization. - Use the
check.rulesConfigparameter to tell Flyway where to find this configuration. Flyway will default to the one in the Flyway installation but that is just intended to help you get started - Update your
sqlfluff.cfgto include the relevant Redgate SQLFluff rules- A number of rules also have configuration options so don't forget to update them if relevant
- Remove the old regex rule(s)
- you can just delete them
- if you don't need this capability at all then it can be disabled using the
check.regexEnabledparameter
Redgate regex -> Redgate SQLFLuff rule mapping
| Regex Rule | Redgate SQLFLuff equivalent | Details |
|---|---|---|
| RX001 | RG01 | Drop Table |
| RX002 | RG08 | Change password |
| RX003 | RG13 | TRUNCATE statement used |
| RX004 | RG14 | DROP COLUMN statement used |
| RX005 | RG07 | GRANT TO PUBLIC statement used |
| RX006 | RG07 | GRANT WITH GRANT OPTION statement used |
| RX007 | RG07 | GRANT WITH ADMIN OPTION statement used |
| RX008 | RG08 | ALTER USER statement used |
| RX009 | RG07 | GRANT ALL statement used |
| RX010 | RG11 | CREATE ROLE statement used |
| RX011 | RG08 | ALTER ROLE statement used |
| RX012 | RG16 | DROP PARTITION statement used |
| RX013 | RG15 | CREATE TABLE statement without a PRIMARY KEY constraint |
| RX014 | RG17 | No Table Description |
...but I want to keep things the way they are
You absolutely can.
- You should store regex the rules you use under your own VCS rather than solely relying on what is in the contents of a Flyway release
- Remember to set the
check.rulesLocationparameter to point to your new rules location.
- Remember to set the
- To avoid duplicate code analysis alerts you can remove the Redgate rules (numbered
RGxx) from the projectsqlfluff.cfgfile
You will have a section that looks like this:
# Comma separated list of rules to check, default to all
rules = ambiguous,convention,structure,RG01,RG02,RG03,RG04,RG06,RG07,RG08,RG09
and you can just remove all the RG01,RG02... items and these rules will then not be run.