本文整理汇总了Python中arango.Arango.delete_database方法的典型用法代码示例。如果您正苦于以下问题:Python Arango.delete_database方法的具体用法?Python Arango.delete_database怎么用?Python Arango.delete_database使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arango.Arango
的用法示例。
在下文中一共展示了Arango.delete_database方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DatabaseManagementTest
# 需要导入模块: from arango import Arango [as 别名]
# 或者: from arango.Arango import delete_database [as 别名]
class DatabaseManagementTest(unittest.TestCase):
"""Tests for managing ArangoDB databases."""
def setUp(self):
self.arango = Arango()
self.db_name = get_next_db_name(self.arango)
# Test database cleaup
self.addCleanup(self.arango.delete_database,
name=self.db_name, safe_delete=True)
def test_database_create_and_delete(self):
self.arango.create_database(self.db_name)
self.assertIn(self.db_name, self.arango.databases["all"])
# Check the properties of the new database
self.assertEqual(self.arango.database(self.db_name).name,
self.db_name)
self.assertEqual(self.arango.database(self.db_name).is_system, False)
# Delete the test database
self.arango.delete_database(self.db_name)
self.assertNotIn(self.db_name, self.arango.databases["all"])
def test_database_properties(self):
db = self.arango.database("_system")
self.assertEqual(db.name, "_system")
self.assertTrue(isinstance(db.properties, dict))
self.assertTrue(is_string(db.id))
self.assertTrue(is_string(db.path))
self.assertEqual(db.is_system, True)
示例2: Arango
# 需要导入模块: from arango import Arango [as 别名]
# 或者: from arango.Arango import delete_database [as 别名]
#! /usr/bin/env python
import ujson
import fileinput
import arango
from arango import Arango
from pprint import pprint
dbcnx = Arango(host="localhost")
try:
dbcnx.delete_database("eris0")
except arango.exceptions.DatabaseDeleteError:
pass
dbcnx.create_database("eris0")
db = dbcnx.database("eris0")
db.create_collection("events")
col = db.collection("events")
col.wait_for_sync = False
def main():
for line in fileinput.input():
line = line.strip()
event = None
try:
event = ujson.loads(line)
except ValueError:
continue
event["_key"] = event["id"]
del event["id"]
col.create_document(event)
示例3: Arango
# 需要导入模块: from arango import Arango [as 别名]
# 或者: from arango.Arango import delete_database [as 别名]
import os
import sys
import uuid
from arango import Arango
db_name = 'fstest'
col_name = 'filesystem'
arango = Arango(host="localhost", port=8529)
try:
arango.delete_database(db_name)
except:
pass
db = arango.create_database(db_name)
graph = db.create_graph('filesystem')
fsnodes = db.create_collection('fsnodes')
graph.create_vertex_collection('fsnodes')
db.create_collection('contains', is_edge=True)
graph.create_edge_definition(
edge_collection='contains',
from_vertex_collections=['fsnodes'],
to_vertex_collections=['fsnodes'])
for dirname, dirnames, filenames in os.walk(sys.argv[1]):
key = dirname.replace('/', '_')
d = dict(type='dir', dirname=dirname, _key=key)
graph.create_vertex('fsnodes', d)