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

Improve Scan response type based on Select option and projected attributes #620

Open
ThomasAribart opened this issue Nov 1, 2023 · 0 comments
Assignees
Labels
Projects

Comments

@ThomasAribart
Copy link
Collaborator

ThomasAribart commented Nov 1, 2023

There are a lot of edge cases based on the presence of an index, wether it is local or global, and what attributes are projected.

Here's a recap of the scan Select JS Docs:

Possible values are ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, COUNT and SPECIFIC_ATTRIBUTE.

By default (no index, no projection expression), Select value is ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES is not a valid Select option, and SPECIFIC_ATTRIBUTE can contain any attribute.

If a local Index is specified:

  • ALL_ATTRIBUTES is possible: DynamoDB will either get attributes from the index if all attributes are projected, either refetch them from the parent table.
  • ALL_PROJECTED_ATTRIBUTES becomes a valid Select option, that should impact the response Items type
  • SPECIFIC_ATTRIBUTE can contain any attribute (to confirm), but at a performance cost if attributes are not projected. It should also impact the response Items type.
  • COUNT is always a valid option

If a global Index is specified:

  • ALL_ATTRIBUTES is possible ONLY IF all attributes are projected. Otherwise, it should lead to an error (to confirm).
  • ALL_PROJECTED_ATTRIBUTES becomes a valid Select option, that should impact the response Items type
  • SPECIFIC_ATTRIBUTE MUST contain only projected attribute (to confirm)
  • COUNT is always a valid option

If a ProjectionExpression is specified:

  • ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES and COUNT are NOT valid Select option
  • SPECIFIC_ATTRIBUTES is the only valid option and is the default value. If an index is specified, we observe the same pattern as above (MUST be projected attribute if index is global, CAN be non-projected attribute if index is local, but at a performance cost).
@ThomasAribart ThomasAribart created this issue from a note in v1 (To do) Nov 1, 2023
@ThomasAribart ThomasAribart self-assigned this Nov 1, 2023
@ThomasAribart ThomasAribart reopened this Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
v1
To do
Development

No branches or pull requests

1 participant