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?
This feature also has some good security uses, like when you only want to expose certain fields on a model.
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 ?
Was dealing with the same issue. Have a looksie under https://stackoverflow.com/questions/50502781/limiting-sql-query-to-defined-fields-columns-in-graphene-sqlalchemy/50770611#50770611
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.
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)
Most helpful comment
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
infoIs there away to get at the fields requested ?