Skip to content

Commit

Permalink
问题:表名带-符号无法正常解析,原因:\w只匹配[a-zA-Z0-9_],修正:(\w*) -> ([\w-]*)
Browse files Browse the repository at this point in the history
  • Loading branch information
taochao committed Oct 18, 2021
1 parent ae58fbd commit b8eabf9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sql/engines/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def execute_check(self, db_name=None, sql=''):
"remove", "replaceOne", "renameCollection", "update", "updateOne",
"updateMany", "renameCollection"]
pattern = re.compile(
r'''^db\.createCollection\(([\s\S]*)\)$|^db\.(\w+)\.(?:[A-Za-z]+)(?:\([\s\S]*\)$)|^db\.getCollection\((?:\s*)(?:'|")(\w*)('|")(\s*)\)\.([A-Za-z]+)(\([\s\S]*\)$)''')
r'''^db\.createCollection\(([\s\S]*)\)$|^db\.(\w+)\.(?:[A-Za-z]+)(?:\([\s\S]*\)$)|^db\.getCollection\((?:\s*)(?:'|")([\w-]*)('|")(\s*)\)\.([A-Za-z]+)(\([\s\S]*\)$)''')
m = pattern.match(check_sql)
if m is not None and (re.search(re.compile(r'}(?:\s*){'), check_sql) is None) and check_sql.count(
'{') == check_sql.count('}') and check_sql.count('(') == check_sql.count(')'):
Expand Down

0 comments on commit b8eabf9

Please sign in to comment.