本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.execute_statement_on_cbas方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.execute_statement_on_cbas方法的具体用法?Python RestConnection.execute_statement_on_cbas怎么用?Python RestConnection.execute_statement_on_cbas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.execute_statement_on_cbas方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute_statement_on_cbas_via_rest
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import execute_statement_on_cbas [as 别名]
def execute_statement_on_cbas_via_rest(self, statement, mode=None, rest=None, timeout=120, client_context_id=None, username=None, password=None):
"""
Executes a statement on CBAS using the REST API using REST Client
"""
pretty = "true"
if not rest:
rest = RestConnection(self.cbas_node)
try:
self.log.info("Running query on cbas: %s"%statement)
response = rest.execute_statement_on_cbas(statement, mode, pretty,
timeout, client_context_id, username, password)
response = json.loads(response)
if "errors" in response:
errors = response["errors"]
else:
errors = None
if "results" in response:
results = response["results"]
else:
results = None
if "handle" in response:
handle = response["handle"]
else:
handle = None
return response["status"], response[
"metrics"], errors, results, handle
except Exception,e:
raise Exception(str(e))