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


Python Arango.delete_database方法代碼示例

本文整理匯總了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)
開發者ID:zopyx,項目名稱:python-arango,代碼行數:33,代碼來源:test_databases.py

示例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)
開發者ID:dip-proto,項目名稱:eris,代碼行數:33,代碼來源:insert.py

示例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)
開發者ID:zopyx,項目名稱:python-arango,代碼行數:33,代碼來源:test2.py


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