-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update mongo.py #2970
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
base: master
Are you sure you want to change the base?
Update mongo.py #2970
Conversation
测试脚本没装新、老版的Mongosh,能过就怪了。 |
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.
ci的对应的yaml也可以做调整装上客户端
sql/engines/mongo.py
Outdated
@@ -383,6 +385,13 @@ def _build_cmd( | |||
common_params["auth_options"] = "" | |||
return cmd_template.format(**common_params) | |||
|
|||
def get_mongosh(self): |
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.
建议放在init方法内
sql/engines/mongo.py
Outdated
@@ -434,6 +443,7 @@ def execute_workflow(self, workflow): | |||
|
|||
def execute(self, db_name=None, sql=""): | |||
"""mongo命令执行语句""" | |||
self.get_mongosh() |
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.
只在execute内覆盖,会导致其他方法找不到类属性报错
@@ -479,7 +489,10 @@ def execute(self, db_name=None, sql=""): | |||
try: | |||
r = json.loads(r) | |||
except Exception as e: | |||
logger.info(str(e)) |
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.
如果明确是版本差异,可以通过客户端版本区分
修改返回内容解析逻辑。 在代码检查中加入mongo-shell。
兼容高版本MongoDB Shell。
Fix: #2969