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.
I'd like to request the ability to have mixed @model & @sql directives. @model being primary and @sql being secondary. For example:
type Location {
id: Int
name: String
}
type User
@model {
id: ID!
user: String!
locations: [Location] @sql(reference: "getLocations")
}
Currently, Amplify is returning @sql directive can only be used on Query or Mutation types
Describe the solution you'd like
I'd like to be able to use the @sql directive within the @model directive just like my example showed. Data doesn't need to be intermingled except when the query returns to the client.
Describe alternatives you've considered
the @sql directive generates Lambda functions. I can currently achieve my goal using the @function directive, but I have to manage the Lambda manually whereas with @sql the function is generated automatically within the CDK construct code. I simply supply the query and access credentials via SSM as instructed here: https://docs.amplify.aws/javascript/build-a-backend/graphqlapi/connect-api-to-existing-database/
Additional context
2175 is a very close and possible replication of this request. Might be different enough though for this one to be a valid request. I'll follow them both just in case.
Is this something that you'd be interested in working on?
[ ] 👋 I may be able to implement this feature request
Describe the feature you'd like to request
I'd like to request the ability to have mixed
@model
&@sql
directives.@model
being primary and@sql
being secondary. For example:Currently, Amplify is returning
@sql directive can only be used on Query or Mutation types
Describe the solution you'd like
I'd like to be able to use the
@sql
directive within the@model
directive just like my example showed. Data doesn't need to be intermingled except when the query returns to the client.Describe alternatives you've considered
the
@sql
directive generates Lambda functions. I can currently achieve my goal using the@function
directive, but I have to manage the Lambda manually whereas with@sql
the function is generated automatically within the CDK construct code. I simply supply the query and access credentials via SSM as instructed here: https://docs.amplify.aws/javascript/build-a-backend/graphqlapi/connect-api-to-existing-database/Additional context
2175 is a very close and possible replication of this request. Might be different enough though for this one to be a valid request. I'll follow them both just in case.
Is this something that you'd be interested in working on?
Would this feature include a breaking change?