我有个问题。我有几个JSON文件。我不想手动创建Collections并导入这些文件。我找到了这个问题Bulk import of .json files in arangodb with python,但不幸的是我得到了一个错误[OUT] AttributeError: 'Database' object has no attribute 'collection'。
如何导入多个JSON文件,并通过Collections中的Python完全自动导入它们
from pyArango.connection import *
conn = Connection(username="root", password="")
db = conn.createDatabase(name="test")
a = db.collection('collection_name') # <- here is the error
for x in list_of_json_files:
with open(x,'r') as json_file:
data = json.load(json_file)
a.import_bulk(data)我还查看了来自ArangoDB https://www.arangodb.com/tutorials/tutorial-python/的文档。
发布于 2022-03-28 14:26:40
db实例中没有"collection“方法,您试图在这一行的代码中调用该方法:
a = db.collection('collection_name') # <- here is the error根据docs,应该使用db实例的db.createCollection方法。
studentsCollection = db.createCollection(name="Students")https://stackoverflow.com/questions/71648225
复制相似问题