For one of my vertex type, I want one of my fields to be same as the primary_id. I tried this:
CREATE QUERY populate_id_fields() FOR GRAPH oc {
S = {entity.*};
UPDATE s FROM S:s
SET s.activerecord_id = str_to_int(s.id);
}
but it’s giving me an error "primary_id not usable in the query body. Is there a workaround for this? Thank you.
Hi Ivan,
Thanks for your question.
It is not allowed directly use s.id without setting primary_id_as_attribute.
To enable that you can
- create that vertex by using the config: WITH primary_id_as_attribute=“true”
- Check the checkbox in GraphStudio
Check as attribute when defining the vertex in Schema Design page.
Please be noted, either way, the system will remove the data of that vertex (including edges connected to that vertex) being changed.
Thanks.