本文整理汇总了Python中couchbase_helper.query_definitions.QueryDefinition.generate_index_create_query方法的典型用法代码示例。如果您正苦于以下问题:Python QueryDefinition.generate_index_create_query方法的具体用法?Python QueryDefinition.generate_index_create_query怎么用?Python QueryDefinition.generate_index_create_query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase_helper.query_definitions.QueryDefinition
的用法示例。
在下文中一共展示了QueryDefinition.generate_index_create_query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_gsi_index_existing_view_index
# 需要导入模块: from couchbase_helper.query_definitions import QueryDefinition [as 别名]
# 或者: from couchbase_helper.query_definitions.QueryDefinition import generate_index_create_query [as 别名]
def test_create_gsi_index_existing_view_index(self):
self.indexes= self.input.param("indexes","").split(":")
query_definition = QueryDefinition(
index_name="test_failure_create_index_existing_index",
index_fields = self.indexes,
query_template = "",
groups = [])
self.query = query_definition.generate_index_create_query(bucket = self.buckets[0].name,
use_gsi_for_secondary = False, gsi_type=self.gsi_type)
try:
# create index
server = self.get_nodes_from_services_map(service_type = "n1ql")
self.n1ql_helper.run_cbq_query(query = self.query, server = server)
# create same index again
self.query = query_definition.generate_index_create_query(bucket = self.buckets[0].name,
use_gsi_for_secondary = True, gsi_type=self.gsi_type)
self.n1ql_helper.run_cbq_query(query = self.query, server = server)
except Exception, ex:
self.log.info(ex)
raise
示例2: test_failure_create_index_big_fields
# 需要导入模块: from couchbase_helper.query_definitions import QueryDefinition [as 别名]
# 或者: from couchbase_helper.query_definitions.QueryDefinition import generate_index_create_query [as 别名]
def test_failure_create_index_big_fields(self):
field_name = ""
field_name += ",".join([str(a) for a in range(1, 100)]).replace(",", "_")
query_definition = QueryDefinition(
index_name="test_failure_create_index_existing_index", index_fields=field_name, query_template="", groups=[]
)
self.query = query_definition.generate_index_create_query(bucket=self.buckets[0], gsi_type=self.gsi_type)
try:
# create index
server = self.get_nodes_from_services_map(service_type="n1ql")
self.n1ql_helper.run_cbq_query(query=self.query, server=server)
except Exception, ex:
msg = "Expression not indexable"
self.assertTrue(msg in str(ex), " 5000 error not recived as expected {0}".format(ex))
示例3: test_failure_create_index_non_existing_bucket
# 需要导入模块: from couchbase_helper.query_definitions import QueryDefinition [as 别名]
# 或者: from couchbase_helper.query_definitions.QueryDefinition import generate_index_create_query [as 别名]
def test_failure_create_index_non_existing_bucket(self):
self.indexes= self.input.param("indexes","").split(":")
query_definition = QueryDefinition(
index_name="test_failure_create_index_existing_index",
index_fields = self.indexes,
query_template = "",
groups = [])
self.query = query_definition.generate_index_create_query(bucket = "not_present_bucket")
try:
# create index
server = self.get_nodes_from_services_map(service_type = "n1ql")
self.n1ql_helper.run_cbq_query(query = self.query, server = server)
except Exception, ex:
msg="Keyspace not found keyspace not_present_bucket - cause: No bucket named not_present_bucket"
self.assertTrue(msg in str(ex),
" 5000 error not recived as expected {0}".format(ex))
示例4: test_failure_create_index_existing_index
# 需要导入模块: from couchbase_helper.query_definitions import QueryDefinition [as 别名]
# 或者: from couchbase_helper.query_definitions.QueryDefinition import generate_index_create_query [as 别名]
def test_failure_create_index_existing_index(self):
self.indexes= self.input.param("indexes","").split(":")
query_definition = QueryDefinition(
index_name="test_failure_create_index_existing_index",
index_fields = self.indexes,
query_template = "",
groups = [])
self.query = query_definition.generate_index_create_query(bucket = self.buckets[0].name)
try:
# create index
server = self.get_nodes_from_services_map(service_type = "n1ql")
self.n1ql_helper.run_cbq_query(query = self.query, server = server)
# create same index again
self.n1ql_helper.run_cbq_query(query = self.query, server = server)
except Exception, ex:
self.assertTrue("Index test_failure_create_index_existing_index already exist" in str(ex),
" 5000 error not recived as expected {0}".format(ex))