Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing parameters to queries #48

Open
gregleleu opened this issue Feb 17, 2019 · 1 comment
Open

Passing parameters to queries #48

gregleleu opened this issue Feb 17, 2019 · 1 comment

Comments

@gregleleu
Copy link

It's useful to be able to pass data as "parameters" in the queries.
(E.g. to load json, see https://neo4j.com/blog/cypher-load-json-from-url/)

I've updated the code in my fork below. Seems to be working so far... if it helps.
(Not doing a pull request as I've not tried every potential impact...)

to_json_neo <- function(query, params, include_stats, meta, type) {
  toJSON(
    list(
      statement = query,
      parameters = params,
      includeStats = include_stats,
      meta = meta,
      resultDataContents = list(type)
    ),
    auto_unbox = TRUE
  )
}
@ColinFay
Copy link
Contributor

ColinFay commented Mar 3, 2019

Hey,

Good idea, thanks for the suggestion :)

As R evaluates parameterq by position, it's a breaking change to move parameters around in a function, so I'd suggest adding this params at the end of call_neo4j here : https://github.com/gregleleu/neo4r/blob/master/R/call_api.R#L41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants