Create Query from command line

Looking at the videos “GSQL 101” I see screenshots like the one below where the GSQL is modeled on the right, and I think it’s executed on the left window.
image

If I create text similar to the screenshot above that is nicely formatted, then attempted to copy/paste into the terminal window:

CREATE QUERY Sample_GSQL(/* Parameters here */) FOR GRAPH MyGraph { 
  /* Write query logic here */ 
  PRINT "Sample_GSQL works!"; 
  PRINT "More good stuff";
}

Two interesting things happen:

  1. When I copy the GSQL code from notepad, as soon as I click into the terminal window the paste action executes.
  2. Every “return” in the text results in hitting the “Enter” command which makes things blow-up.

image

Question: How do you create large nicely formatted queries from the command line?

Thank you.

Hi George,

There are two ways.

  1. store your query content in a file, and run gsql console using the query file as a parameter.

gsql -g social query.gsql

  1. use begin and end
    2.1 from gsql consol, type begin then enter key
    2.2 paste your query, then enter key
    2.3 type end, then enter key

Thanks.

Ah, that worked perfect. Thank you.