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

Feature: Across entities query #503

Open
yamatatsu opened this issue Sep 25, 2023 · 4 comments
Open

Feature: Across entities query #503

yamatatsu opened this issue Sep 25, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@yamatatsu
Copy link

Across entities query is the essence of single-table design.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-relational-modeling.html

As electrodb, if also onetable gets support of across entities query, it will be super extra value of this product I think.
https://electrodb.dev/en/core-concepts/single-table-relationships/

@mobsense
Copy link
Contributor

Generally, we try to design our keys and indexes so that a single query can fetch a collection. Is this what you mean or do you mean OneTable providing an API that will do multiple low level DynamoDB operations?

Can you give an example:

@yamatatsu
Copy link
Author

yamatatsu commented Oct 9, 2023

Hi mobsense.

I mean to get multiple entities not items.

Example:

await table.find(["User", "Order"], { userId: "user_anyuuid1" });
// return: {
//   user: [
//     {
//       pk: "user_anyuuid1",
//       sk: "user_anyuuid1",
//       userId: "user_anyuuid1",
//     }
//   ],
//   order: [
//     {
//       pk: "user_anyuuid1",
//       sk: "order_anyuuid1",
//       orderId: "order_anyuuid1",
//       orderedBy: "user_anyuuid1",
//     },
//     {
//       pk: "user_anyuuid1",
//       sk: "order_anyuuid2",
//       orderId: "order_anyuuid2",
//       orderedBy: "user_anyuuid1",
//     },
//   ]
// }

ElectroDB can query like as this with typescript typing. https://electrodb.dev/en/modeling/collections/

I believe it is very helpful for users using TS.

@mobsense mobsense added the enhancement New feature or request label Oct 10, 2023
@mobsense
Copy link
Contributor

Thank you.

@darbio
Copy link

darbio commented Jun 17, 2024

This would be a great addition to the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants