Repository navigation
docs(sql): the upsert script of the SQL Script page declares the properties it writes (#12421) - #558
Open
shaunpatterson wants to merge 1 commit into
Conversation
…erties it writes (#12421) The setup created the two UNIQUE indexes on properties the script never declared, and CREATE INDEX refuses a property the type does not have, so the script failed on its first statement. The setup now declares the properties the script writes, the two the indexes are built on first.
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs(sql): the upsert script of the SQL Script page declares the properties it writes (#12421)
The setup of the upsert script created the two
UNIQUEindexes on properties the script never declared, andCREATE INDEXrefuses a property the type does not have:The script therefore failed on its first statement, and the promise of the page ("Run the script twice with the same
email/nameand you still end up with exactly oneAccountand oneCity") could not be followed.The setup now declares the properties the script writes, the two the indexes are built on first:
Verified on
26.12.1-SNAPSHOT(build658d3c384be0f0f53a897288c4796e77e4987ce4), running the setup and the script exactly as printed, throughPOST /api/v1/command/<db>with thesqlscriptlanguage:Cannot create the index on type 'City.name' because the property does not exist, and the script then answeredUpsert must involve a UNIQUE index to retrieve the records...;City, oneAccountand oneLivesedge, the edge pointing at the two vertices:Two notes, both measured:
CREATE PROPERTYhas noIF NOT EXISTS(CREATE PROPERTY N.k2 STRING IF NOT EXISTSis a syntax error), so the setup is a one-time setup, as the page already says. The types and the indexes keep theirIF NOT EXISTS.Lives.sinceis not strictly needed: the script also runs with onlyCity.nameandAccount.emaildeclared, the properties the indexes need, and the undeclared ones are stored anyway. It is declared here so that the schema of the example is the one the script writes.One more observation, left alone because it is a separate matter from the missing properties: with
COMMIT RETRY 100as printed, the SQL Script entry point answers an empty result, although the rows are written; with a plainCOMMITthe same script answers the rows of the finalSELECT.