c0d3x27 commented on issue #343:
URL: https://github.com/apache/age/issues/343#issuecomment-1365148718

   It sounds like you would like to be able to use the SET clause in AGE to 
copy all properties from one entity to another, without having to specify each 
property name individually.
   
   One alternative you could consider is using the FOREACH clause in your query 
to iterate over all of the properties of the source entity and set them on the 
destination entity. The FOREACH clause allows you to execute a block of 
statements for each element in a list, so you could use it to loop over all of 
the properties of the source entity and set them on the destination entity one 
by one.
   
   For example, you could use a query like the following to copy all properties 
from one node to another:
   
   `MATCH (source:Label)
   MATCH (destination:Label)
   FOREACH (property IN keys(source) |
     SET destination[property] = source[property]
   )`
   
   This query would match the source and destination nodes, then use the 
FOREACH clause to iterate over all of the properties of the source node. For 
each property, it would use the SET clause to set the corresponding property on 
the destination node to the value of the source property.
   
   Alternatively, you could consider using the apoc.create.setProperties 
procedure from the APOC library to copy all properties from one node to another 
in a single call. This procedure takes two node IDs as arguments and copies all 
properties from the first node to the second.
   
   For example, you could use a query like the following to copy all properties 
from one node to another:
   `MATCH (source:Label)
   MATCH (destination:Label)
   CALL apoc.create.setProperties(destination, source) YIELD node
   RETURN node`
   
   This query would match the source and destination nodes, then use the 
apoc.create.setProperties procedure to copy all properties from the source node 
to the destination node in a single call.


-- 
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