def dump(path, collection):
# 备份
cmd = ("arangodump "
f"--server.endpoint http+tcp://{ip}:{port} "
f "--server.username {用户名} "
f "--server.password {password} --server.authentication true "
f"--server.database {database} "
f"--collection {collection} "
"--overwrite true "
"--include-system-collections true "
f"--output-directory {path}")
os.system(cmd)
def store(path, collection):
# 导出
cmd = ("arangorestore "
"--server.endpoint http+tcp://{ip}:{port} "
"--server.username {用户名} "
"--server.password {password} --server.authentication true "
"--server.database {database} "
f"--collection {collection} "
"--include-system-collections true "
f"--input-directory {path}")
os.system(cmd)
# colletion_list=['productcategory', 'financial', 'fund', 'riskcategory', 'third_login']
for collection in colletion_list:
# dump('/home/hedy/AssistantManageEngine/assistant_manage_engine/models', collection)
store('/home/hedy/AssistantManageEngine/assistant_manage_engine/models', collection)