Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archery 工单里同时出现CREATE table 和DELETE FROM时,";"的位置前没有空格会报错 #1169

Closed
zhirongmm opened this issue Aug 24, 2021 · 1 comment
Labels
question Further information is requested

Comments

@zhirongmm
Copy link

问题描述

Archery 工单里同时出现CREATE table 和DELETE FROM时,";"的位置前如果没有空格会报错,无法进行SQL检测。
后台日志会出现如下报错
from edf;,错误信息Traceback (most recent call last):
File "/opt/archery/sql/engines/oracle.py", line 445, in execute_check
elif len(object_name_list) > 0 and self.get_dml_table(db_name=db_name, sql=sql_lower,
File "/opt/archery/sql/engines/oracle.py", line 230, in get_dml_table
table_name = re.match(r"^delete\s+from\s(.+?)\s", sql, re.M).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
image

image

版本信息

  • 应用版本/分支:CentOS Linux release 7.9
  • 部署方式:Docker
@zhirongmm zhirongmm added the question Further information is requested label Aug 24, 2021
@nick2wang
Copy link
Collaborator

正则匹配问题,已提交pr
1.delete语句没有where条件时匹配不到最后一个空格
table_name = re.match(r"^delete\s+from\s(.+?)", sql, re.M).group(1)

2.同时发现insert语句漏匹配insert all when... into这种情况
table_name = re.match(r"^insert\s+((into)|(all\s+into)|(all\s+when\s(.+?)into))\s(.+?)((|\s)", sql, re.M).group(6)

hhyo added a commit that referenced this issue Dec 1, 2021
Co-authored-by: 小圈圈 <rtttte@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants