I'm using edgedb with python.
My db scheme is
type Student {
link class -> Class {
on target delete allow;
};
};
type Class {
required property year -> int32;
required property name -> str;
}
I'm running query like this
with student_to_update := (
select Student {
id,
class: {
id,
name,
year
}
}
filter .id = <uuid>$student_id
)
update student_to_update
set {class := (select Class filter .id = <uuid>$class_id)};
I got an error modification of computed link 'class' of object type 'default::Student' is prohibited
.
Probably it something related to backlinks, but in my schema link is direct.
This looks like a bug. I opened an issue for it here https://github.com/edgedb/edgedb/issues/4346
To work around this, remove the shape from the select in the with block.
with
student_to_update := (select Student filter .id = <uuid>$student_id),
updated := (update student_to_update set {
class := (select Class filter .id = <uuid>$class_id),
}),
select updated {
id,
class: {
id,
name,
year
}
};