Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Limit fields fetched from database for graphene-django #402

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

Closed
nyejon opened this issue Feb 22, 2018 · 5 comments
Closed

Limit fields fetched from database for graphene-django #402

nyejon opened this issue Feb 22, 2018 · 5 comments

Comments

@nyejon
Copy link

nyejon commented Feb 22, 2018

Hi,

I have a relatively wide database table and use graphene to fetch maybe one or two fields from it. At the moment with the Django ORM it will fetch the entire record by default. Is there a way to integrate the only('col1', 'col2') for each column or field requested in the query? This should make the whole process much faster especially on wide tables where one wants maybe all records from one column.

Maybe there is a way to do this already?

@ramorris3
Copy link

This feature also has some good security uses, like when you only want to expose certain fields on a model.

@esatterwhite
Copy link

This is the first thing I looked into doing after I installed this package. Even if there were a way to get at the fields that were requested, I could do the restriction in the resolver function manually. But I don't see a way to get at that information on info

Is there away to get at the fields requested ?

@somada141
Copy link

@stale
Copy link

stale bot commented Jun 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 11, 2019
@stale stale bot closed this as completed Jun 18, 2019
@themotu
Copy link

themotu commented Jul 8, 2019

A query like this:

{
  allTimeobjects (first:1) {
   edges {
    node {
      id,
      beginning,
      end,
      elapsed
    }
  }
  }
}

Executes the exact same SQL as this:

{
  allTimeobjects {
   edges {
    node {
      id,
      beginning,
      end,
      elapsed
    }
  }
  }
}

They also both select all columns and not only the ones we are asking for. (only tested on sqlite but assume postgresql would be the same behavior)

@graphql-python graphql-python locked and limited conversation to collaborators Apr 14, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

6 participants