Skip to content
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

fix: treating id field as implicit primary key which we miss today #2008

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

phani-srikar
Copy link
Contributor

Description of changes

The primary key transformer does not recognize the default id: ID! field on a model as implicit primary key and hence does not generate any resolvers for that field. One of the issues arising this is that the preAuth slot for Sync Queries is not generated which causes the Sync to be slow as it scans the whole table even if the filter is specified on the id field by the customers. Other side effects include missing pre-Auth slots that set the primary key information for CRUD operation resolvers for the models.
Please see the snapshot changes for the full change set.
This could be a breaking change since we're generating several new resolver slots and their overall evaluation might break existing apps.

CDK / CloudFormation Parameters Changed

Issue #, if available

Description of how you validated changes

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Any CDK or CloudFormation parameter changes are called out explicitly

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@phani-srikar phani-srikar requested a review from a team as a code owner November 1, 2023 23:45
@@ -135,24 +135,24 @@ batch:
CLI_REGION: us-east-1
depend-on:
- publish_to_local_registry
- identifier: api_1_resolvers_sync_query_datastore_api_6
- identifier: rds_pg_refersTo_api_1_resolvers_sync_query_datastore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will go away once my other commit shows up on Github. I pushed it but its not there yet for some reason.

Comment on lines +1012 to +1017
type Song @model {
id: ID!
name: String!
genre: String!
}
`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a suite of tests that validates the entire app generated for this schema is the same as what is generated if there's an explicit @primaryKey on id? That'd give me more confidence that we're doing the right thing across all transformers in concert.

@phani-srikar phani-srikar marked this pull request as draft November 2, 2023 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants