本文整理汇总了Python中arangodb.api.Database类的典型用法代码示例。如果您正苦于以下问题:Python Database类的具体用法?Python Database怎么用?Python Database使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Database类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_and_delete_database
def test_create_and_delete_database(self):
database_name = 'test_foo_123'
db = Database.create(name=database_name)
self.assertIsNotNone(db)
Database.remove(name=database_name)
示例2: tearDown
def tearDown(self):
# Delete index
self.geo_index.delete()
self.hash_index.delete()
self.fulltext_index.delete()
self.skiplist_index.delete()
# They need to be deleted
Collection.remove(name=self.test_1_col.name)
Database.remove(name=self.database_name)
示例3: test_get_all_databases
def test_get_all_databases(self):
databases = Database.get_all()
self.assertTrue(len(databases) >= 1)
for db in databases:
self.assertTrue(isinstance(db, Database))
示例4: setUp
def setUp(self):
self.database_name = 'testcase_index_222_123'
self.db = Database.create(name=self.database_name)
self.operating_collection = 'bar_extra'
self.test_1_col = Collection.create(name=self.operating_collection)
示例5: setUp
def setUp(self):
self.database_name = 'testcase_aqlquery_123'
self.db = Database.create(name=self.database_name)
self.test_1_col = self.db.create_collection('foo_1')
self.test_2_col = self.db.create_collection('foo_2')
self.col1_doc1 = self.test_1_col.create_document()
self.col1_doc1.little_number = 33
self.col1_doc1.loved = False
self.col1_doc1.small_text = "lll aa"
self.col1_doc1.save()
self.col1_doc2 = self.test_1_col.create_document()
self.col1_doc2.little_number = 1
self.col1_doc2.loved = False
self.col1_doc2.small_text = "aaa aa"
self.col1_doc2.save()
self.col1_doc3 = self.test_1_col.create_document()
self.col1_doc3.little_number = 3
self.col1_doc3.loved = True
self.col1_doc3.small_text = "xxx tt"
self.col1_doc3.save()
self.col2_doc1 = self.test_2_col.create_document()
self.col2_doc1.little_number = 33
self.col2_doc1.loved = False
self.col2_doc1.save()
self.col2_doc2 = self.test_2_col.create_document()
self.col2_doc2.little_number = 11
self.col2_doc2.loved = True
self.col2_doc2.save()
示例6: setUp
def setUp(self):
self.database_name = 'testcase_int_abc'
self.collection1_name = 'int32_collection_abc'
self.collection2_name = 'int64_collection_xyz'
self.coll3_name = 'dec10_coll_123'
self.coll4_name = 'dec20_col2_456'
self.db = Database.create(name=self.database_name)
self.col1 = self.db.create_collection(self.collection1_name)
self.col2 = self.db.create_collection(self.collection2_name)
self.col3 = self.db.create_collection(self.coll3_name)
self.col4 = self.db.create_collection(self.coll4_name)
示例7: setUp
def setUp(self):
self.database_name = 'testcase_simple_query_123'
self.db = Database.create(name=self.database_name)
# Create test data
self.test_1_col = self.db.create_collection('foo_1')
self.test_2_col = self.db.create_collection('foo_2')
self.col1_doc1 = self.test_1_col.create_document()
self.col1_doc1.ta='fa'
self.col1_doc1.bla='aaa'
self.col1_doc1.save()
self.col1_doc2 = self.test_1_col.create_document()
self.col1_doc2.ta='fa'
self.col1_doc2.bla='xxx'
self.col1_doc2.save()
self.col2_doc1 = self.test_2_col.create_document()
self.col2_doc1.save()
示例8: tearDown
def tearDown(self):
Collection.remove(name=self.collection1_name)
Collection.remove(name=self.collection2_name)
Collection.remove(name=self.coll3_name)
Collection.remove(name=self.coll4_name)
Database.remove(name=self.database_name)
示例9: tearDown
def tearDown(self):
# They need to be deleted
Collection.remove(name=self.test_1_col.name)
Collection.remove(name=self.test_2_col.name)
Database.remove(name=self.database_name)
示例10: tearDown
def tearDown(self):
Collection.remove(name=self.operating_collection)
Database.remove(name=self.database_name)
示例11: setUp
def setUp(self):
self.database_name = 'test_case_list_field_123'
self.db = Database.create(name=self.database_name)
示例12: Client
##################################
# These tests
##################################
# Init client
from arangodb.query.advanced import Query
from arangodb.query.simple import SimpleQuery
client = Client('arango.nix.bra')
# Create database in which all collections are created
database_name = 'arangopy_speed_test_database'
try:
Database.create(database_name)
except:
client.set_database(database_name)
timer = timeit.default_timer
def timer_decorator(message):
def outer_wrapper(func):
def wrapper(*args, **kwargs):
start = timer()
func(*args, **kwargs)
elapsed = timer() - start
print(message % elapsed)
return wrapper
示例13: tearDown
def tearDown(self):
Database.remove(name=self.database_name)