本文整理汇总了Python中couchbase_helper.query_definitions.QueryDefinition类的典型用法代码示例。如果您正苦于以下问题:Python QueryDefinition类的具体用法?Python QueryDefinition怎么用?Python QueryDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QueryDefinition类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_failure_drop_index_non_existing_index
def test_failure_drop_index_non_existing_index(self):
query_definition = QueryDefinition(
index_name="test_failure_create_index_existing_index", index_fields="crap", query_template="", groups=[]
)
self.query = query_definition.generate_index_drop_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)
except Exception, ex:
msg = "GSI index test_failure_create_index_existing_index not found"
self.assertTrue(msg in str(ex), " 5000 error not recived as expected {0}".format(ex))
示例2: test_failure_create_index_big_fields
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
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
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))
示例5: test_create_gsi_index_existing_view_index
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)
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 += " USING GSI "
self.n1ql_helper.run_cbq_query(query = self.query, server = server)
except Exception, ex:
self.log.info(ex)
raise