Arangodb--初始化collection

使用pyarango进行创建需要的集合和边内容(用来进行初始化arangodb脚本)

安装

pip install pyarango

脚本

from pyArango.connection import *

# 用户名
username = ""
# 密码
password = ""
# arangodb地址
arangoURL = "http://127.0.0.1:8529"

# 需要创建的 集合名
collection_edge = ["RELATION_80",
                   "person_vehicle"]

collection_docu = ["ENTITY_08",
                   "company"]
# connect arangodb
conn = Connection(username=username, password=password, arangoURL=arangoURL)

db = conn["test"]
# db = conn.createDatabase(name="test")

# 创建边collection
for it in collection_edge:
    db.createCollection(name=it, className="Edges")

# 创建doucument的collection
for it in collection_docu:
    db.createCollection(name=it, className="Collection")

你可能感兴趣的:(后端--开发)