-
Notifications
You must be signed in to change notification settings - Fork 713
Description
Is your feature request related to a problem? Please describe.
In current date and age, most DB engines do not care if any of the tokens are upper or lower case. One could argue that it is a good practice to keep keywords uppercase for readability, but sqlparse should not attempt to be an opinionated linter.
I need to detect "SELECT foo FROM bar INTO baz" statements, which is a quirky replacement for CREATE TABLE AS SELECT in MS SQL Server. I cannot use Token.match
for this, however: I would need to explicitly list every single combination of uppercase and lowercase letters in SELECT (Select, select, etc.) if I wanted to use this method. This is 64 possible combinations. Not doing this.
Describe the solution you'd like
An additional parameter (can still default to existing behavior) to allow case ignore when matching Keyword tokens.
Describe alternatives you've considered
Monkey patching my own function
Relevant doc page:
https://sqlparse.readthedocs.io/en/0.1.3/analyzing/#sqlparse.sql.Token.match
Relevant code:
Line 90 in a2c7e64
def match(self, ttype, values, regex=False): |