-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
修复union-bug-1360 #1371
修复union-bug-1360 #1371
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1371 +/- ##
==========================================
+ Coverage 74.89% 74.91% +0.01%
==========================================
Files 82 82
Lines 13181 13191 +10
==========================================
+ Hits 9872 9882 +10
Misses 3309 3309
Continue to review full report at Codecov.
|
还有点问题,得看看 |
sql/utils/go_data_masking.py
Outdated
@@ -19,6 +19,7 @@ | |||
#不修改整体逻辑,主要修改由goInception返回的结果中关键字,比如db修改为schema | |||
def go_data_masking(instance, db_name, sql, sql_result): | |||
"""脱敏数据""" | |||
particular_flag=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
额, 这个变量名能不能取更直白的? 特殊标记, 怎么特殊, 到底代表的是什么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗷,我想想,
我主要考虑的是其中有union或者concat关键字时的特殊处理,想用1,2,3这样的代码来简要判断
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那可以直接列表列出来他拥有的特别关键字
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1,2,3 这样的代码不是很明显, 会忘记的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1,2,3 这样的代码不是很明显, 会忘记的
好滴,后面再修改看看,
goInception那边的树有点问题,我没懂啥意思。
如果使用goinception的脱敏暂时不能达到inception的效果,可以和最开始的pr一样,做成可选,方便发布下一个release版本 |
多等等吧,那边的同学没反馈呢。 |
可以了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整体使用格式化工具进行一下格式化
sql/utils/go_data_masking.py
Outdated
import logging | ||
from pickle import TRUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个引用下面好像没用
sql/utils/go_data_masking.py
Outdated
@@ -29,11 +33,19 @@ def go_data_masking(instance, db_name, sql, sql_result): | |||
sql_result.error = '不支持该查询语句脱敏!请联系管理员' | |||
sql_result.status = 1 | |||
return sql_result | |||
#设置一个特殊标记,要是还有特殊关键字特殊处理,如果还有其他关键字需要特殊处理再逐步增加 | |||
elif token.ttype is Keyword and token.value.upper() in ['UNION','UNION ALL']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面if的空无用可以去掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方不需要保留么?
我感觉要是后面有不支持的关键字往里填就行。。。
sql/utils/go_data_masking.py
Outdated
for d in query_tree: | ||
|
||
#print(bool([s for s in values if d['field'] in s['field'] ])) | ||
if bool([s for s in values if d['field'] in s['field'] ]) is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not 就可以
test_go_data_masking_union_support_keyword |
可以先在本地跑unit test,打印更详细的日志 |
操,傻叉了我,晚点改下 |
fix #1360