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 79 forks source link

Feature Request: Support for single table designs #2722

Open sisygoboom opened 5 months ago

sisygoboom commented 5 months ago

Environment information

System:
  OS: Windows 10 10.0.19045
  CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
  Memory: 14.98 GB / 31.93 GB
Binaries:
  Node: 18.18.2 - C:\Program Files\nodejs\node.EXE
  Yarn: undefined - undefined
  npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
  pnpm: 8.10.5 - C:\Program Files\nodejs\pnpm.CMD
NPM Packages:
  @aws-amplify/backend: 1.0.3
  @aws-amplify/backend-cli: 1.0.4
  aws-amplify: 6.3.4
  aws-cdk: 2.144.0
  aws-cdk-lib: 2.144.0
  typescript: 5.4.5
AWS environment variables:
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
  AWS_STS_REGIONAL_ENDPOINTS = regional
No CDK environment variables

Description

Hi, the data modelling is currently great for getting started, and the automatic graphql client code generation stuff is terrific.

In the future, I foresee applications maturing and deciding to go down the route of single table design for low cost and high performance at scale.

Since a single table is the AWS recommended way of using dynamodb once access patterns are clearly defined, I'm surprised that it is not supported in Amplify gen 2. At least allowing people to say hey, these models should all be on the same table would be a massive leap forward as that would allow for manual composite key management.

Please see this implementation for an idea of what I'm proposing.

kekami commented 5 months ago

Have you seen this?

https://github.com/aws-amplify/docs/pull/7659

sisygoboom commented 5 months ago

Thank you

sisygoboom commented 4 months ago

@kekami It looks like that guide is incomplete and no longer being worked on. While I'm on the subject, I tried to implement the existing guide, and it seems to use a hacky workaround that isn't well supported by the current code's design. It does not generate client code for Flutter (it generates .ts instead of .dart), nor does it mention how to authorize the function to perform dynamodb:Query, for example as that is no longer automated.

ykethan commented 4 months ago

Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂