arangodb / python-arango

The official ArangoDB Python driver.
https://docs.python-arango.com
MIT License
448 stars 75 forks source link

No recognized create_edge_collection attribute for Graph object #16

Closed sLLiK closed 8 years ago

sLLiK commented 8 years ago

Only a slight variation of the example provided in the documentation at: http://python-driver-for-arangodb.readthedocs.io/en/latest/graph.html#edge-collections

from arango import ArangoClient

client = ArangoClient(host="localhost", port=8529)
db = client.db('_system')
db.create_graph('schedule')
schedule = db.graph('schedule')

# Create some vertex collections
schedule.create_vertex_collection('profs')
schedule.create_vertex_collection('courses')

# Create a new edge definition (and a new edge collection)
schedule.create_edge_collection(
    name='teaches',
    from_collections=['profs'],
    to_collections=['courses']
)

Error returned:

Traceback (most recent call last):
  File "./test.py", line 15, in <module>
    schedule.create_edge_collection(
  File "/usr/lib/python3.5/site-packages/arango/api.py", line 13, in __getattribute__
    method = object.__getattribute__(self, attr)
AttributeError: 'Graph' object has no attribute 'create_edge_collection'

Versions: Python3, python-arango v3.0

joowani commented 8 years ago

Hi sLLiK,

Oops, it's supposed to be create_edge_definition. I will make the correction in the documentation.

Thanks, Joohwan

joowani commented 8 years ago

I've corrected the mistake and updated the link to the documentation: http://python-driver-for-arangodb.readthedocs.io/en/master/

Thanks!