Open nikolaimerritt opened 1 year ago
Can I clarify whether you intended the insert
to be a separate query from the match-delete
or a part of a match-delete-insert
query flow?
Thanks!
I'm encountering the same issue... I'm trying to write a big insert script like this example to populate a database, but I need to be able to run it over and over to iterate on it. So I want it to start with a "delete all data from the database" like those examples do (unless there's an upsert
statement, which I couldn't see).
However, if I put match $all isa thing; delete $all isa thing;
at the beginning of the .tql
file, before a bunch of unrelated insert
statements, it gives that error: None of the variables in 'insert' ... is within scope of 'match' ('[$all]')
.
It seems like you have to use a hack to work around this, by putting a single insert
statement immediately following the match $all isa thing; delete $all isa thing;
, such as insert $all isa ______, has....
; and then you can follow it with as many unrelated inserts as you want. This is an awkward constraint though; I would rather just be able to run the "delete all" and then specify that the following inserts are unrelated and don't need to be tied to the same variables.
Description
Calling
match
anddelete
with one variable, andinsert
with another, results in a TypeQL Error. Theinsert
should be independent of thematch
anddelete
.Environment
Reproducible Steps
Steps to create the smallest reproducible scenario:
name sub attribute, value string;
person sub entity, owns name @key;
match $a isa person, has name "alice"; delete $a isa person; insert $b isa person, has name "bob";
[TQL18] TypeQL Error: None of the variables in 'insert' ('[$b isa person, has name "bob"]') is within scope of 'match' ('[$a]')