當前位置: 首頁>>代碼示例>>Python>>正文


Python query_definitions.QueryDefinition類代碼示例

本文整理匯總了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))
開發者ID:prasanna135,項目名稱:testrunner,代碼行數:12,代碼來源:indexcreatedrop_2i.py

示例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))
開發者ID:prasanna135,項目名稱:testrunner,代碼行數:14,代碼來源:indexcreatedrop_2i.py

示例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))
開發者ID:lichia,項目名稱:testrunner,代碼行數:16,代碼來源:indexcreatedrop_2i.py

示例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))
開發者ID:lichia,項目名稱:testrunner,代碼行數:17,代碼來源:indexcreatedrop_2i.py

示例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
開發者ID:lichia,項目名稱:testrunner,代碼行數:19,代碼來源:indexcreatedrop_2i.py


注:本文中的couchbase_helper.query_definitions.QueryDefinition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。