-
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
修复mongodb不能执行长sql的问题 #1556
修复mongodb不能执行长sql的问题 #1556
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1556 +/- ##
==========================================
- Coverage 76.84% 76.79% -0.06%
==========================================
Files 91 91
Lines 14309 14320 +11
==========================================
+ Hits 10996 10997 +1
- Misses 3313 3323 +10
Continue to review full report at Codecov.
|
sql/engines/mongo.py
Outdated
else: | ||
cmd = "{mongo} --quiet -u {user} -p '{password}' {host}:{port}/{auth_db} <<\\EOF\nrs.slaveOk();{sql}\nEOF".format( | ||
mongo=mongo, user=self.user, password=self.password, host=self.host, port=self.port, db_name=db_name, sql=sql, auth_db=auth_db) | ||
logger.debug(cmd) |
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.
LGTM
@fancy-lee 已经改了,你看看行吗。如果有不合理的地方,麻烦帮忙指出或修改 |
目测没有问题 |
@czxin788 这里又引出了来个新的bug,也可能是后面加执行影响行数的代码没有测试到,就是用load执行完了,返回结果默认会加一个true |
* 修复mongodb不能执行长sql的bug * 临时文件用tempfile.NamedTemporaryFile()方法,使代码更优雅 * 移除logger.debug(cmd),为过代码扫描 * 修复mongodb不显示执行结果的问题 * 当mongodb sql长度大于4000个字符时,使用load方法执行sql;小于4000个字符时,直接执行sql,这样可以减少磁盘交换,节约archery性能
问题详情见:
fix: #1552