Skip to content

Excution ERR['int' object does not support indexing] #10

@afidegnum

Description

@afidegnum

I'm trying to run a recursive query that will enable me to process the nodes which can be used for additional operations, and came across the error above:
when I tested individual queries, they works perfectly

def graph_nodes(tag_id):
    top = ag.execCypher("MATCH (n:node) WHERE id(n) = %s RETURN n", params=(tag_id,))
    x = [r[0] for r in top]
    print(x[0]["tag"])
    children = ag.execCypher("MATCH (v:node)-[R:connect]-(V2) WHERE id(v) = %s RETURN V2", params=(x[0]).id,)
    for c in children:
        print(c)
        graph_nodes(c[0].id)

cursor = ag.execCypher("MATCH (n:node {tag: 'html'}) RETURN n")    
t = [x[0].id for x in cursor]
print(t[0])
graph_nodes(t[0])
TypeError                                 Traceback (most recent call last)
~/.virtualenvs/orgs/lib/python3.9/site-packages/age/age.py in execCypher(conn, graphName, cypherStmt, cols, params)
    106     try:
--> 107         cursor.execute(stmt, params)
    108         return cursor

TypeError: 'int' object does not support indexing

During handling of the above exception, another exception occurred:

SqlExcutionError                          Traceback (most recent call last)
/tmp/ipykernel_117955/2082054997.py in <module>
     11 t = [x[0].id for x in cursor]
     12 print(t[0])
---> 13 graph_nodes(t[0])

/tmp/ipykernel_117955/2082054997.py in graph_nodes(tags)
      3     x = [r[0] for r in top]
      4     print(x[0]["tag"])
----> 5     children = ag.execCypher("MATCH (v:node)-[R:connect]-(V2) WHERE id(v) = %s RETURN V2", params=(x[0].id,)
      6     for c in children:
      7         print(c)

~/.virtualenvs/orgs/lib/python3.9/site-packages/age/age.py in execCypher(self, cypherStmt, cols, params)
    156 
    157     def execCypher(self, cypherStmt:str, cols:list=None, params:tuple=None) -> ext.cursor :
--> 158         return execCypher(self.connection, self.graphName, cypherStmt, cols=cols, params=params)
    159 
    160     def cypher(self, cursor:ext.cursor, cypherStmt:str, cols:list=None, params:tuple=None) -> ext.cursor :

~/.virtualenvs/orgs/lib/python3.9/site-packages/age/age.py in execCypher(conn, graphName, cypherStmt, cols, params)
    112     except Exception as cause:
    113         conn.rollback()
--> 114         raise SqlExcutionError("Excution ERR[" + str(cause) +"](" + stmt +")", cause)
    115 
    116 

SqlExcutionError: ("Excution ERR['int' object does not support indexing](SELECT * from cypher('text_test', $$ MATCH (v:node)-[R:connect]-(V2) WHERE id(v) = %s RETURN V2 $$) as (v agtype);)", TypeError("'int' object does not support indexing"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions