lnoir opened a new issue, #210: URL: https://github.com/apache/incubator-age/issues/210
I came across [this question](https://github.com/apache/incubator-age/issues/113) which has an example for my scenario, however I'm having trouble with it. If I have a vertex I want to create or modify, how do I create a dynamic query in the case that: * there are a predefined set of modifiable properties * it isn't known _which_ properties will be present at the time the query is run * at least one property will be present Below are a couple of contrived but concrete examples of queries modifying different properties on the same vertex. Assume the vertex with `user_id: 1` already exists. ### Example 1 Query updating a user's favourite things: ``` SELECT * FROM ag_catalog.cypher('userdata', $$ MATCH (f:favs {user_id: 1}) SET f.food = $food, f.drink = $drink, f.movie = $movie RETURN f $$) as (f ag_catalog.agtype); ``` Data: `{food: 'pizza', drink: 'strawberry milkshake', movie: 'Donne Darko'}` ### Example 2 Same vertex, but different properties modified: ``` SELECT * FROM ag_catalog.cypher('userdata', $$ MATCH (f:favs {user_id: 1}) SET f.food = $food, f.music = $music RETURN f $$) as (f ag_catalog.agtype); ``` Data: `{food: 'calzone', music: 'The Lark Ascending'}` From my experimentation with prepared statements, I've found I can create and modify vertices, but the properties must be known beforehand. I'd like to be able to build dynamic insert queries and update queries where the properties aren't known until run time. I want to avoid having to write multiple prepared statements to do essentially the same thing. Is it possible? -- 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]
