cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Parameters multiple lines

I am using browser 4.3.1. I have a problem in setting parameters. If I want to set the parameter as a long query with multiple lines. There is error "\n". How to deal with this?

4 REPLIES 4

Looks like you are trying to use sql syntax. What are you trying to accomplish?

I am trying to create nodes based on snowflake query result to neo4j. The snowflake query needs to have double quotes around columns. For example,
select "grade" from table where "name" = 'amy'. I want to do it in apoc. periodic.iterate and double quotes cannot be escaped properly.

CALL apoc.periodic.iterate(
'CALL apoc.load.jdbc("snowflakeconnect", "select "grade" from table where "name" = 'amy' ",) YIELD row', ...)

I found out I can execute the query properly if I set it as a parameter.

:param Query => 'select "grade" from table where "name" = 'amy' '
CALL apoc.periodic.iterate(
'CALL apoc.load.jdbc("snowflakeconnect", $Query,) YIELD row', ...)

But the parameter only works if I write the query in one line. I am hoping to solve this problem in a more "readable" way, especially when I have a very long query.

I want to create node based on snowflake query result. Snowflake query needs double quotes around the column name, for example,

"select "grade" from table where "name" = 'amy' "

I want to do it in apoc.periodic. iterate and double quotes cannot be escaped properly.

CALL apoc.periodic.iterate( 'CALL apoc.load.jdbc("snowflakeconnect", "select "grade" from table where "name" = 'amy' ",) YIELD row',....)

I found out I can execute the query by setting it as a parameter.

:param Query => 'select "grade" from table where "name" = 'amy' ';
CALL apoc.periodic.iterate( 'CALL apoc.load.jdbc("snowflakeconnect", $Query,) YIELD row',....)

The parameter only works when I write it in one line. I want to know how can we solve this in a more "readable" way, especially when I have a long query.

I suppose you can store each line as a parameter and send the concatenation of the lines to the iterate procedure.

:params {line1: "line one text", line2: " line two text"}
with $line1 + $line2 as queryString
CALL apoc.periodic.iterate( 'CALL apoc.load.jdbc("snowflakeconnect", queryString,) YIELD row',....)