chore: Bump sqlparse to 0.4.4 (#24045)

Co-authored-by: sebastianliebscher <liebscher.sebastian@protonmail.ch>
This commit is contained in:
EugeneTorap 2023-05-23 10:15:24 +03:00 committed by GitHub
parent 7891cea7f7
commit a7f9c66e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -288,7 +288,7 @@ sqlalchemy-utils==0.38.3
# via
# apache-superset
# flask-appbuilder
sqlparse==0.4.3
sqlparse==0.4.4
# via apache-superset
sshtunnel==0.4.0
# via apache-superset

View File

@ -122,7 +122,7 @@ setup(
"slack_sdk>=3.19.0, <4",
"sqlalchemy>=1.4, <2",
"sqlalchemy-utils>=0.38.3, <0.39",
"sqlparse>=0.4.3, <0.5",
"sqlparse>=0.4.4, <0.5",
"tabulate>=0.8.9, <0.9",
"typing-extensions>=4, <5",
"waitress; sys_platform == 'win32'",

View File

@ -23,6 +23,8 @@ from urllib import parse
import sqlparse
from sqlalchemy import and_
from sqlparse import keywords
from sqlparse.lexer import Lexer
from sqlparse.sql import (
Identifier,
IdentifierList,
@ -59,15 +61,13 @@ CTE_PREFIX = "CTE__"
logger = logging.getLogger(__name__)
# TODO: Workaround for https://github.com/andialbrecht/sqlparse/issues/652.
sqlparse.keywords.SQL_REGEX.insert(
0,
(
re.compile(r"'(''|\\\\|\\|[^'])*'", sqlparse.keywords.FLAGS).match,
sqlparse.tokens.String.Single,
),
)
# configure the Lexer to extend sqlparse
# reference: https://sqlparse.readthedocs.io/en/stable/extending/
lex = Lexer.get_default_instance()
sqlparser_sql_regex = keywords.SQL_REGEX
sqlparser_sql_regex.insert(25, (r"'(''|\\\\|\\|[^'])*'", sqlparse.tokens.String.Single))
lex.set_SQL_REGEX(sqlparser_sql_regex)
class CtasMethod(str, Enum):