Download and Replace sqlite file in Core Data

I create a database with lots of data in sqlite using CoreData, and the process to do as requisitions and add in the database is very long. My idea is to make an API that processes this data the previous day and generates an sqlite file compresses and leaves it stalled, then when the application synchronizes it it downloads that .sqlite file already with the populated data and only inserts the sqlite file in the application for data manipulation.
This is possible right ??

@fguitar1 Thanks very much for your question!

Is this for an iOS app? I’m asking because you honestly should not be constantly creating new SQLite files. If you’re downloading data from the server, you should only be parsing JSON data from your API and then loading/updating the data into your existing Core Data persistence layer. The only time you really should be creating a NEW SQLite file is when you’re doing a migration. If you’re simply updating the data, but the architecture of your Core Data model is the same, then there should be no reason to be making changes to the file itself.

I hope this helps!

All the best!

Yes it is for IOS app. Actually in this application I set up an sqlite database for each user that does in the app, the need for it because the application must make queries offline, then the bank is always destroyed before creating a new bank, this is unfortunate the API logic (legacy code) :sob:. The problem is that each time the amount of data is increasing, and the number of requests in the API is also a long and time consuming process between ordering and iterating through the dictionary. The process is very costly. I wanted to leave this extensive processing for a service where it would do the whole process and save the ready sqlite file into a folder just for the user upon entering the system just download the file and handle. Sorry about my English. hahaha

This topic was automatically closed after 166 days. New replies are no longer allowed.