Munmud opened a new issue, #856:
URL: https://github.com/apache/age/issues/856

   After adding an edge using python driver I want to get to know the id of the 
edge. But I found that it doesn't return any object. When adding vertex it 
return a vertex object. But for edge it returns nothing. I have added vertex 
and edge in the following way
   
   ### Connection
   ```py 
   import psycopg2
   import age
   # set DB path and graph name
   connnection = psycopg2.connect(
       host="localhost", 
       port="5430", 
       dbname="postgresDB", 
       user="postgresUser", 
       password="postgresPW")
   GRAPH_NAME = 'test_Graph'
   age.setUpAge(connection, GRAPH_NAME)
   ```
   
   ### Adding Edge (Doesn't Return anything)
   ```py
   with connection.cursor() as cursor:
       query ="""
   SELECT * from cypher(
       'test_Graph', 
       $$ 
           MATCH (a), (b)
           WHERE id(a) = 844424930131969 AND id(b) = 844424930131970
           CREATE (a)-[r:ProjectLeader {firstMeet : 'Jan-21-2019'}]->(b)
       $$) as (v agtype);
       """ % (
           GRAPH_NAME,
           mapId[id1],
           mapId[id2],
           edge_label, 
           dictToStr(edge_prop)
       )
       print(query)
       try :
           cursor.execute(query)
           
           for row in cursor:
               print(row[0])
               print(row)
               print(cursor)
           connection.commit()
       except Exception as ex:
           print('Exception : ',type(ex), ex)
           # if exception occurs, you must rollback all transaction. 
           connection.rollback()
   ```
   
   ### Adding Vertex (Works successfully)
   ```py
   
   with connection.cursor() as cursor:
     query = """
     SELECT * from cypher(
         'test_Graph', 
         $$ 
             CREATE (v:People {name : 'Moontasir',weight : '50kg'}) 
             RETURN v
         $$
     ) as (v agtype);
     """ )
     try :
         cursor.execute(query)
         for row in cursor:
             print(row[0].id)
                 
         # When data inserted or updated, You must commit.
         connection.commit()
     except Exception as ex:
         print(type(ex), ex)
         # if exception occurs, you must rollback all transaction. 
         connection.rollback()
   ```
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to