Sync SQLite data with FireBase automatically - sqlite

Actually my data is in GB so every time manually sync for updating is not make sense. So I want to sync my SQLite database with Firebase database automatically, either it may be offline or online. And I want syncing from both ways. "FB to SQLite" and "SQLite to FB".

Is it in Android ? if you already have functionality to manual sync the data, then should not be a problem to automate it. You can call same sync functionality through a service, which in turn will use CountDownTimer. CountDownTimer as per preference can be called every couple of minutes or hourly.

There is no built-in functionality for Firebase to synchronize with SQlite, nor built-in functionality in SQlite to synchronize with Firebase.
But since both have an API, you can write code to do the synchronization for you.

Actually firebase use persistency to work while offline but dynamically can get only last event whatever it is. So have to write our own Sync for that.

Related

Does Firebase Realtime Database support auto data syncing between multiple databases?

Here is our use case:
We have way more than 200,000 clients need to connect to firebase realtime db. So we created multiple database with same data and load blance the connections.
Here is the problem:
If we update one database, we will have to initiate connection and udpate the rest of the database as well. I would like to check if there is a way to auto sync up data between multiple databases.
Docs I have went through:
https://firebase.google.com/docs/database/usage/limits
https://firebase.google.com/docs/database/usage/sharding
Also I checked rules, and it seems that rules is not meant to be used to sync data.
Thanks
firebaser here
There is nothing built into Firebase to automatically synchronize data between multiple database instances. A common way to implement this when writing through a server-side process, is to simply write to each database in turn there.
If the data you want to write comes from a client-side SDK, I'd have the client write it to a staging area (just a temporary node in the database), and then use Cloud Functions to write the data the permanent location in all database instances.

How to undo the change in Firestore?

I am using Firestore NoSQL for iOS application. While debugging, I occasionally executed setData instead of updateData, what led to lost of all the user data (one user).
Is there a way to reverse back the changes?
How to do Versioning for Firestore, for similar cases, so there's a way to cancel/ backup. I don't quite know, but I've read that it supposed to be Versioning.
There is no option to undo changes in Firestore. I'd recommend creating a new database (project) for testing purposes so you don't accidentally write on the main database. For now if it's just a single user then I'd recommend manually add that back.
Unlike realtime database, you can only have one Firestore instance per project at the moment so you may have to create a new project but I think that'll be safe to prevent such accidental writes :)
"You can use the Cloud Firestore managed export and import service to recover from accidental deletion of data and to export data for offline processing."
That's what I've found for now: https://firebase.google.com/docs/firestore/manage-data/export-import

Will Firebase firestore offline persistence work with offline electron js application?

I am working with electron js and angular. And I want to use firestore database.
As far as I know, firestore is enabled with auto persistency.
First of all, will it work with my desktop application (node base / electron + angular)?
Second, let's say my application mostly works offline. And I need to do certain CRUD operations during these uncertain offline runtimes. So, if the first question's answer is yes, can I perform above operations in offline mode and will it sync as soon as the system goes online?
Third and last, if the answer to the second question is yes, then what if my system shutdowns that is desktop?
I will be glad for a detailed explanation of answers and a detailed explanation of how persistence works and is provided.
I am new to this channel. Please don't mind if I ask my question informally.
Firebase saves all offline actions to essentially an internal transaction pool for offline persistence. When Firebase does connect back online, it will attempt to sync all previous changes including transactions, document updates, and deletes.
The issue is the local pool wasn't made for extended offline use and over time, depending on how much data, it can slow the app down to handle all the data.
I've heard it should behave fine if the device is offline for about a month or two for general use but it might be better to support your offline app with an offline-first database such as PouchDB or NeDB and sync changes with Firebase as needed.

AngularFIre Firebase saving data locally?

I have an app that displays a list of items. Here is what I am doing.
When the app first loads I am making an HTTP request to get the list from the firebase database.
once the list is received the list is stored locally on localStorage for future use.
On future app loads, the list is loaded from localStorage to prevent unnecessary http calls
I am doing the above programmatically, i.e, saving data to localStorage and check for new data and getting it etc.
Does firebase provide any other way to the same?
There is no built-in support for cross page-reload persistence in the JavaScript SDK for the Firebase Realtime Database. Somebody is working on such functionality in the open-source repository, but no release was made with it yet.
If you need this functionality, I highly recommend looking into using Cloud Firestore. In addition to many other benefits, it supports cross page-reload persistence.

Firebase for half and SQL for another half

I have built an app using firestore as we are interested in the realtime updates portion of things. However,we are not building a website that has CRM component where a lot of reports will be generated. The contents of that CRM are all new. There is only one report that would need firebase data as well as the new data (you can say 1 report out of 20).
I was thinking of building the CRM backend off mysql DB? Do you recommend to go with this approach or shall I do the CRM in the same firebase/firestore db?
Thanks
If you are looking for a real-time backend database for your CRM, then the Firebase RTDB / Cloud Firestore would be ideal for this. I'm not sure why you'd want to add a mySQL component, unless you are going to create some reports that require complex joins. However, if your data is modelled correctly, this also shouldn't be an issue.
Take a look at this video to get a better understanding: What is a NoSQL Database? How is Cloud Firestore structured? - Get to Know Cloud Firestore Ep.1

Resources