RSS

Using Multiple Database – TinyDB

26 Apr

logo

TinyDB is a Storage component that can be used to store data for an app; i.e it is a persistent data store for the app. The data stored in a TinyDB will be available each time the app is run. An example might be a game that saves the high score and retrieves it each time the game is played.

Data for TinyDB is stored using key (tag), value pairs. To store data, you specify the tag it should be stored under. Subsequently, you can retrieve the data that was stored under a given tag. The value for a tag can be a simple text or complex data structure like List of Lists.

Each app has its own data store. By default, there is only one data store per app. Even if you have multiple TinyDB components, they will use the same data store. Image below shows using 2 TinyDB but the underlying code is using the same data-store.

If your app has complex requirement and you require Multiple Independent data-stores, then AppyBuilder includes such feature / capability and will allow you break your data into multiple separate independent storage – see image below.

Image below shows how this can be accomplished. In this example, we have used 2 TinyDB, but notice that using block TinyDB.DatabaseName, we are assigning a unique name to our database. This name can be anything as long as it is unique and does not contain special characters or embedded spaces. For purpose of this tutorial, we are using same tag (platform) to store different values in each of the databases. When we retrieve data, you’ll notice that each database returns the correct value that it stored.

Website: http://AppyBuilder.com

Use AppyBuilder GOLD for FREE: http://FreeGold.AppyBuilder.com

Share, Like us below 🙂

 
Leave a comment

Posted by on April 26, 2017 in Uncategorized

 

Leave a comment