Skip to content

Commit aa5ff9b

Browse files
committed
Add path to cypher source reference in csv reports
1 parent 90cffac commit aa5ff9b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/executeQuery.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ cypher_query=$(echo -n "${original_cypher_query}" | jq -Rsa .)
8080
#echo "Cypher Query: $cypher_query"
8181

8282
# Put the query inside the structure that is expected by the Neo4j HTTP API
83-
cypher_query_for_api="{\"statements\":[{\"statement\":${cypher_query},\"includeStats\": true}]}"
83+
cypher_query_for_api="{\"statements\":[{\"statement\":${cypher_query},\"includeStats\": false}]}"
8484
#echo "Cypher Query for API: ${cypher_query_for_api}"
8585

8686
# Calls the Neo4j HTTP API using cURL ( https://curl.se )
8787
cyper_query_result=$(curl --silent -S --fail-with-body -H Accept:application/json -H Content-Type:application/json \
8888
-u neo4j:"${NEO4J_INITIAL_PASSWORD}" \
8989
"http://localhost:${NEO4J_HTTP_PORT}/${NEO4J_HTTP_TRANSACTION_ENDPOINT}" \
9090
-d "${cypher_query_for_api}")
91-
#echo "Cypher Query Result: $cyper_query_result"
91+
#echo "executeQuery: Cypher Query Result: ${cyper_query_result}"
9292

9393
# If there is a error message print it to syserr >&2 in red color
9494
error_message=$( echo "${cyper_query_result}" | jq -r '.errors[0] // empty' )
@@ -102,7 +102,7 @@ fi
102102
if [ "${no_source_reference}" = true ] ; then
103103
echo -n "${cyper_query_result}" | jq -r '(.results[0])? | .columns,(.data[].row)? | map(if type == "array" then join(",") else . end) | flatten | @csv'
104104
else
105-
cypher_query_file_basename=$(basename -- "${cypher_query_file_name}")
106-
sourceFileReferenceInfo="Source Cypher File: ${cypher_query_file_basename}"
105+
cypher_query_file_relative_name=${cypher_query_file_name#/**/cypher/}
106+
sourceFileReferenceInfo="Source Cypher File: ${cypher_query_file_relative_name}"
107107
echo -n "${cyper_query_result}" | jq -r --arg sourceReference "${sourceFileReferenceInfo}" '(.results[0])? | .columns + [$sourceReference], (.data[].row)? + [""] | map(if type == "array" then join(",") else . end) | flatten | @csv'
108108
fi

0 commit comments

Comments
 (0)