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

arc.tables indexes #370

Open
reconbot opened this issue Feb 18, 2021 · 2 comments
Open

arc.tables indexes #370

reconbot opened this issue Feb 18, 2021 · 2 comments

Comments

@reconbot
Copy link
Member

I want to have some sort of runtime validation for my use of indexes. I can do a describe table but I think arc/functions might be an interesting place to do the discovery like it does for tables.

The index name and fields would be nice.

const tables = await arc.tables()
const tableName = tables.name('users')
const indexes = tables.indexes('users)
// { "email-index": { hash: 'email', sort: 'createdAt' } }

I'm not sure I nailed the result object but it's close.

@filmaj
Copy link
Member

filmaj commented May 26, 2021

That's interesting. So you're thinking in the same place where arc/functions creates individual table client interfaces, we also augment that client interface with index key schemas too? Describe table also provides the main table's key schema so we can also infer from that. I'm open to it.

My one concern is that this introduces an additional API call (Describe Table) per table defined in the app. If you're using arc/functions tables() in a short-lived lambda invocation for a single API operation for a single table, if calling DescribeTable is done aggressively for all tables right from the start, that could have serious performance consequences. If this API call could be implemented so that it lazily loads this information, per table, then I'd be open to that, i.e. making it async (and e.g. calling the Describe Table API once and then caching the result).

@reconbot
Copy link
Member Author

I guess that would because the indexes are not in the configuration like the table names?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants