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

Super Graph returns a row instance when the table name is singular #7

Closed
FourSigma opened this issue Oct 3, 2019 · 2 comments
Closed

Comments

@FourSigma
Copy link
Contributor

query {
  actor {
    actor_id
    first_name
    last_name
  }
}

Expected Behaviour

Should return an array of actors.

{
  "data": {
    "actor": [{
      "actor_id": 1,
      "first_name": "Penelope",
      "last_name": "Guiness"
    },
    {...},
    {...}]
  }
}

Actual Behavior

Returns one instance of an actor.

{
  "data": {
    "actor": {
      "actor_id": 1,
      "first_name": "Penelope",
      "last_name": "Guiness"
    }
  }
}

Steps to Reproduce the Problem

  1. The behaviour happens when the table name is singular (actor vs actors).
  2. ALTER TABLE actor RENAME TO actors fixes the issue

Misc

I built super graph from the source code, ran go build . modified the the dev.yaml file

@FourSigma FourSigma changed the title Super Graph return a row instance when the table name is singular Super Graph returns a row instance when the table name is singular Oct 3, 2019
@dosco
Copy link
Owner

dosco commented Oct 5, 2019

That a feature the name used in the GraphQL selector does not directly map to the database table so if you use actor you will only get 1 value for all use actors. Your table name can be either.

query { actors { actor_id } }

@FourSigma
Copy link
Contributor Author

I downloaded and re-compiled it is working now!

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