本文整理匯總了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