Comments (16)
Thank you for posting this.
- Can you share the verbose logs and code snippets in the ticket?
- Are you seeing errors while syncing data from AppSync?
from amplify-swift.
@thisisabhash
Verbose logs -
select
"root"."@@PrimaryKey" as "@@PrimaryKey", "root"."user_id" as "user_id", "root"."time_stamp" as "time_stamp",
"root"."breath_rate" as "breath_rate", "root"."calories" as "calories", "root"."createdAt" as "createdAt",
"root"."data_timezone" as "data_timezone", "root"."distance_covered" as "distance_covered", "root"."heart_rate" as "heart_rate",
"root"."hrv" as "hrv", "root"."owner" as "owner", "root"."ring_serial_no" as "ring_serial_no",
"root"."skin_temperature" as "skin_temperature", "root"."spo2" as "spo2", "root"."step_count" as "step_count",
"root"."updatedAt" as "updatedAt"
from "TimedData" as "root"
where 1 = 1
and (
"root"."user_id" = '74'
and "root"."time_stamp" between '2024-05-04T18:30:00.000Z' and '2024-05-11T18:29:59.000Z'
)
order by "root"."time_stamp" asc
select
"root"."@@PrimaryKey" as "@@PrimaryKey", "root"."user_id" as "user_id", "root"."time_stamp" as "time_stamp",
"root"."breath_rate" as "breath_rate", "root"."calories" as "calories", "root"."createdAt" as "createdAt",
"root"."data_timezone" as "data_timezone", "root"."distance_covered" as "distance_covered", "root"."heart_rate" as "heart_rate",
"root"."hrv" as "hrv", "root"."owner" as "owner", "root"."ring_serial_no" as "ring_serial_no",
"root"."skin_temperature" as "skin_temperature", "root"."spo2" as "spo2", "root"."step_count" as "step_count",
"root"."updatedAt" as "updatedAt"
from "TimedData" as "root"
where 1 = 1
and (
"root"."user_id" = '74'
and "root"."time_stamp" between '2024-05-04T18:30:00.000Z' and '2024-05-11T18:29:59.000Z'
)
order by "root"."time_stamp" asc
And not getting any errors also
from amplify-swift.
Can you enable verbose logs like this
Amplify.Logging.logLevel = .verbose
and then start your app and call relevant DataStore APIs? Datastore.start() / Datastore.query()
? Does it return an empty list? or does it throw an error?
from amplify-swift.
@thisisabhash
Yes, it is already enabled.
from amplify-swift.
@thisisabhash please see the whole verbose after doing Datastore.start() -
from amplify-swift.
Hi @amruth-movano ,
Could you share how you are configuring the datastore plugin?
The Datastore.query
performs local queries against a local SQL database, which contains only the data that has been synced. This process depends on how you have defined your sync predicate and the configuration options for your local datastore, such as the maximum number of synced records.
Since it's impractical to store all server-side data locally, you might need to use an API.query to fetch records from your remote AppSync server with predicate for old data, especially for those that exceed the maximum synced records stored locally for the initial full sync.
from amplify-swift.
Hi @5d
Please see attached files. We are calling startAndPopulateDataStore from DataStoreManager class, whenever users logins or launch the app. Also maximum sync records limit is 15000. And for all data to fetch we are using datastore fetch query like -
public func fetchTimedData(from start: Date, to end: Date) async throws -> [DataStore.TimedData] {
let userId = try await userId()
let results = try await dataStore.query(
TimedData.self,
where: TimedData.keys.user_id.eq(userId).and(TimedData.keys.time_stamp.between(
start: start.temporalDateTime,
end: end.temporalDateTime
)),
sort: nil,
paginate: nil
)
return results.compactMap(TimedDataMapper.map)
}
from amplify-swift.
@thisisabhash @5d
Also I want to know,
for our users in India Timezone, data is populating very fast but in US timezone data population is taking so much time.
from amplify-swift.
Hi @amruth-movano ,
What is the typical or average volume/amount of data that is stored in your App?
Since you have configured a maximum limit of 15,000 records in your application's data store, if you clear the data store and perform a full synchronization, would the number of records exceed the 15,000 limit? In other words, once the datastore reaches the 15,000 record limit, what would be the earliest date of the records that were synchronized and stored?
from amplify-swift.
@thisisabhash @5d Also I want to know, for our users in India Timezone, data is populating very fast but in US timezone data population is taking so much time.
Hi @amruth-movano ,
There are many factors that could influence the data synchronization speed.
- In which region or geographic location is your application deployed?
- What is the networking environment like for the devices you are using for testing? Are they connected to a local network, the cellular internet, or behind a VPN?
from amplify-swift.
Hi @amruth-movano ,
What is the typical or average volume/amount of data that is stored in your App?
Since you have configured a maximum limit of 15,000 records in your application's data store, if you clear the data store and perform a full synchronization, would the number of records exceed the 15,000 limit? In other words, once the datastore reaches the 15,000 record limit, what would be the earliest date of the records that were synchronized and stored?
Yes we have set max limit to 15000. So Ideally when we login it should store 15000 records from cloud to local cache. And we should get the data but in the current behaviour for some region we are not getting today's day data also immediately. Sometimes it is taking half an hour to load the data.
Yes we are able to see more than 15000 records locally when internet is off.
from amplify-swift.
Hi @5d, I tried updating my max sync records to 50000 and I am able to get the data. But on datastore.fetch call it's not returning anything, it is only showing the data when max sync records is done.
So fetching is not happening with datastore directly, it is happening with data which is synced locally i.e. from 50000 records. But we want to fetch the data from datastore directly.
Also while syncing datastore is syncing from oldest data first, is there any way to add sorting on how should it sync i.e. I want datstore should sync the latest data first
from amplify-swift.
Hi @5d @thisisabhash
Can we connect if possible to discuss the exact scenarios?
from amplify-swift.
Current Scenario -
I set syncMaxRecodrs to 15000. It is only showing 15000 records from the first record for that users. i.e. if my first row time in db is 01-01-2024 then it is syncing first 15000 data from that date.
So, now issue is I am not getting my latest data though it is there in DB. The dataStore.query function from amplify datastore not returning anything but for older dates I am getting data from datastore.
from amplify-swift.
Hi @amruth-movano,
So fetching is not happening with datastore directly, it is happening with data which is synced locally i.e. from 50000 records. But we want to fetch the data from datastore directly.
The DataStore.query
method queries the local SQL database and is designed to function even when the device is offline. Are you suggesting that you want to retrieve the data directly from DynamoDB?
Also while syncing datastore is syncing from oldest data first, is there any way to add sorting on how should it sync i.e. I want datstore should sync the latest data first
Currently, because the default database table in DynamoDB uses a unique identifier as the partition key, it is difficult to sync the datastore with the most recent records in order. Does your app need offline functionality? If not, you might want to consider using the API plugin directly. To perform mutations with the API plugin, you will need to disable conflict resolution.
from amplify-swift.
Related Issues (20)
- GraphQL query works in appsync console but not on client HOT 5
- Data Race - Thread Sanitizer HOT 6
- Amplify SwitUI - Auth Signout documentation error HOT 3
- Crash in save<Models> from DataStoreBaseBehavior HOT 3
- Amplify JSON Issue HOT 2
- Linker Error when using SPM dependency as a dynamic library HOT 18
- Crash on Amplify.add(plugin HOT 4
- Crash on AuthCategory.getCurrentUser() HOT 4
- Upload failure with error Amplify.StorageError error 7 HOT 13
- Logging happens when set to log level none HOT 3
- Old data not visible for some users HOT 19
- Fetch `ListIdentityProviders` Amplify using getEscapeHatch HOT 7
- All production users local data gets lost on DataStore migration HOT 6
- Crash on AppSyncRealTimeClient.monitorHeartBeats(_:) + 428 HOT 8
- Real-time event subscriptions do not working when the app is in the background. HOT 2
- Request to change amplify model name. HOT 7
- Bug in documentation HOT 5
- iOS App Using AWS Amplify DataStore Does Not Receive Subscriptions for Deletes Made via AWS Lambda HOT 10
- iOS Amplify Apple SignIn successfully but could not access other resources(S3) HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-swift.