Amplify-cli: Datastore efficient query and subscription for multi tenant app

Created on 21 Mar 2020  路  3Comments  路  Source: aws-amplify/amplify-cli

Note: If your question is regarding the AWS Amplify Console service, please log it in the
official AWS Amplify Console forum

Which Category is your question related to?
Datastore

Amplify CLI Version
4.16.1
You can use amplify -v to check the amplify cli version on your system

What AWS Services are you utilizing?
Amplify Datastore, Api

Hello

I don't find in the doc the answer to my question.
I have a multi tenant app and all my queries are scoped using @key indexes. (to be more efficient)
I now want to switch to the new Datastore service. How to use my custom indexes to query data using Datastore? I know queries are done against the local storage, but when sync against my dynamo db table I want those queries to be efficient and to use my indexes and therefore avoid scan operations.

The same problem exists for subscription: I want to be able to scope my obersvers to only scoped data. I dont want to get all updated, just those i'm concerned for (in my tenant scope)
I was able to override subscriptions using graphql API but it seems i can use them with datastore.

@key DataStore question

Most helpful comment

Thank you i left another comment in
https://github.com/aws-amplify/amplify-js/issues/5119#issuecomment-607188246
as suggested :-)

All 3 comments

We are going to be adding this functionality in the near future as noted in the below issues. In the meantime, can you provide us with explicit examples of your GraphQL schema and how you might like the scoping to look?

https://github.com/aws-amplify/amplify-js/issues/5119#issuecomment-601512874
https://github.com/aws-amplify/amplify-js/issues/4552#issuecomment-580856039

@undefobj I am going through a similar issue as @mdebo. Where would the best place to provide examples be? This thread?

Thank you i left another comment in
https://github.com/aws-amplify/amplify-js/issues/5119#issuecomment-607188246
as suggested :-)

Was this page helpful?
0 / 5 - 0 ratings