aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
89 stars 77 forks source link

[GraphQL] Use Projection Expression when `GetItem` and `Query` #200

Open yaquawa opened 3 years ago

yaquawa commented 3 years ago

Currently, GetItem and Query operation on the VTL are not using Projection Expression according to the requested GraphQL field.

I have items with large data in specific attributes, this causes a serious problem on both performance and running cost.

attilah commented 3 years ago

@yaquawa to make sure we are clear on the feature request itself, could you please add more information about the scenario you want to solve, example schemas, expected behavior, how could you imagine defining the projection attributes, is it for builtin @model operations or only for @key defined queries?

yaquawa commented 3 years ago

For example, if I have a schema like this

type Post {
    id: ID!
    content: String
    title: String
}

even I query with only title field, at the backend, content is still fetched, think about what will happen if the content contains 10MB byte data.

query {
   getPost(id){
       title
    }
}