Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create graph: ValueError("'%s' is not a defined a Collection" % colName) #191

Open
nsa32752 opened this issue Sep 4, 2020 · 0 comments

Comments

@nsa32752
Copy link

nsa32752 commented Sep 4, 2020

Hi, I'm trying to create graph using createGraph(name='', createCollections=), but value error raised.

The collection and relation were created like below:

from pyArango.connection import *
from pyArango.collection import *

def create_collection(table):
    conn = Connection(username="root", password="root")
    db = conn["_system"]
    if db.hasCollection(table):
        db[table].delete()
        db.reload()
    collec = db.createCollection(className='Collection', name=table)
    doc1 = collec.createDocument({"_key":table})
    doc1.save()

def create_relation(table, rel_name, relation):
    conn = Connection(username="root", password="root")

    db = conn["_system"]

    if db.hasCollection(rel_name):
        rel = db[rel_name]
    else:
        rel = db.createCollection(className='Edges', name=rel_name)

I didn't use follows:

class collection(Collection):
    _fields = {
        "name": Field()
    }

class relation(Edges):
    _fields = {
        "number": Field()
    }

Because the names of collections and relations are function parameter, the class could not be used as the example above. However I failed to create graph without using the class. Also, I want to use function parameter when I make a graph. Are there solutions for these?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant