Skip to content

Commit

Permalink
[修复]split_withsqls
Browse files Browse the repository at this point in the history
  • Loading branch information
longfengpili committed Dec 7, 2022
1 parent 767a40e commit a913cb4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pydbapi/sql/parse.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @Author: chunyang.xu
# @Email: [email protected]
# @Date: 2020-06-03 10:51:08
# @Last Modified time: 2022-12-07 15:38:13
# @Last Modified time: 2022-12-07 17:03:59
# @github: https://github.com/longfengpili

#!/usr/bin/env python3
Expand Down Expand Up @@ -86,7 +86,7 @@ def split_withsqls(self):
if not sql.lower().startswith('with'):
raise Exception(f"Sql should startswith [with], but startswith [{sql[:4]}] !!!")

sqls = re.split('?<=\)),\n+.*?\n*(?=.*?as *\n)', sql)
sqls = re.split('(?<=\)),\n+.*?\n*(?=.*?as *\n)', sql)
if sqls[-1].startswith('select'):
sql_last = sqls[-2] + sqls[-1]
sqls = sqls[:-2] + [sql_last]
Expand Down

0 comments on commit a913cb4

Please sign in to comment.