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

Support DQL variables in mutations #4615

Closed
F21 opened this issue Jan 18, 2020 · 3 comments
Closed

Support DQL variables in mutations #4615

F21 opened this issue Jan 18, 2020 · 3 comments
Labels
area/querylang/vars Issues related to queries with GraphQL variables area/upsert Issues related to upsert operations. kind/enhancement Something could be better. Stale status/accepted We accept to investigate/work on it.

Comments

@F21
Copy link
Contributor

F21 commented Jan 18, 2020

Experience Report

What you wanted to do

I want to perform a mutation in an upsert block using user-provided data safely.

What you actually did

upsert ($name: string){
      query {
        var(func: eq(xid, "http://schema.org/Person")) {
          Type as uid
        }
        var(func: eq(<http://schema.org/name>, "Robin Wright")) {
          Person as uid
        }
      }
      mutation {
          set {
           uid(Person) <xid> "https://www.themoviedb.org/person/32-robin-wright" .
           uid(Person) <http://schema.org/type> uid(Type) .
           uid(Person) <http://schema.org/name> $name .
           uid(Person) <dgraph.type> "Person" .
          }
      }
    }

Why that wasn't great, with examples

GraphQL variables are not supported in mutations, so it's impossible to safely mutate user-provided data without error-prone validation.

Any external references to support your case

None at the moment.

@MichelDiz MichelDiz added area/querylang/vars Issues related to queries with GraphQL variables area/upsert Issues related to upsert operations. kind/enhancement Something could be better. labels Jan 20, 2020
@sleto-it sleto-it added the status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it label Feb 13, 2020
@miko
Copy link

miko commented Mar 5, 2020

I also support this request. The rationale is the same as for GraphQL variables in queries: https://docs.dgraph.io/query-language/#graphql-variables

@MichaelJCompton
Copy link
Contributor

This looks like a reasonable feature request.

I'm tagging it as accepted, which means it will get into our backlog of features to consider.

If we decide to implement it, we'll post an update here.

@MichaelJCompton MichaelJCompton added status/accepted We accept to investigate/work on it. and removed status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it labels Mar 11, 2020
milosgajdos added a commit to milosgajdos/kraph that referenced this issue Apr 26, 2020
Turns out, GraphQL variables are not yet supported in dgraph upserts.
dgraph-io/dgraph#4615
@MichelDiz MichelDiz reopened this Aug 1, 2022
@MichelDiz MichelDiz changed the title Support GraphQL variables in mutations Support DQL variables in mutations Nov 17, 2022
@dgraph-io dgraph-io deleted a comment from minhaj-shakeel Jan 9, 2023
@MichelDiz MichelDiz moved this from 🆕 In review to NOW in Feature Requests - PM RoadMap Jan 9, 2023
Copy link

github-actions bot commented Aug 6, 2024

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

@github-actions github-actions bot added the Stale label Aug 6, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/querylang/vars Issues related to queries with GraphQL variables area/upsert Issues related to upsert operations. kind/enhancement Something could be better. Stale status/accepted We accept to investigate/work on it.
Development

No branches or pull requests

6 participants