[FREE] 🗄️BigDB - Advanced key-value storage with TTL, metadata, multi-table support, encryption, and more

đź§© BigDB

Extension for MIT AI2
BigDB - Advanced key-value storage with TTL, metadata, multi-table support, encryption, and more
My Other Extensions
Built by Sarthak Gupta

BigDB is a feature-rich, scalable, and secure alternative to TinyDB, designed for complex App Inventor projects. Its support for multi-table storage, TTL, encryption, asynchronous operations, and advanced querying makes it ideal for modern, data-intensive applications. Whether you're building a secure app, managing large datasets, or needing real-time notifications, BigDB provides the tools to elevate your App Inventor projects! :star2:

Benefits of BigDB vs. TinyDB in App Inventor :rocket:

BigDB (com.bigdb) is a powerful key-value storage extension for App Inventor, offering advanced features that surpass the capabilities of TinyDB. Below are the key advantages of using BigDB, with comparisons to TinyDB:

Feature BigDB TinyDB Benefit
Multi-Table Support :clipboard: Supports multiple tables for organized data (SetTable). Single namespace only. Better data organization and scalability. :star2:
TTL (Time-to-Live) :alarm_clock: Set expiration times (Expire, PurgeExpired). No TTL support. Automates data lifecycle management. :hammer_and_wrench:
Metadata Support :memo: Store and query metadata (SetMetadata, FindByMetadata). No metadata support. Enhances data searchability and context. :mag:
Encryption :lock: Database encryption (SetPassword, IsEncrypted). No encryption. Protects sensitive data. :shield:
Asynchronous Operations :zap: Async data retrieval (Get, Keys). Synchronous operations. Improves app responsiveness. :rocket:
Bulk Operations :package: Bulk store/delete (BulkStore, BulkDelete). Individual operations only. Speeds up large dataset management. :chart_with_upwards_trend:
Data Import/Export :outbox_tray::inbox_tray: CSV and JSON support (ExportCSV, ImportJSON). No built-in import/export. Simplifies data portability. :floppy_disk:
Change Notifications :bell: Watch key changes (Watch, Unwatch). No notifications. Enables reactive programming. :satellite:
Advanced Querying :mag_right: Query by metadata, JSON records (FindByMetadata, GetRecord). Basic key-value retrieval. Supports complex data operations. :bar_chart:
Database Management :straight_ruler: Check size, list tables (DBSize, ListTables). No such utilities. Improves storage monitoring. :toolbox:
Indexing :gear: Automatic key indexing for faster lookups. No indexing. Enhances query performance. :racing_car:
Error Handling :stop_sign: Robust error reporting (ErrorOccurred). Limited error feedback. Simplifies debugging and reliability. :white_check_mark:

:memo: Specifications


:package: Package: com.bigdb
:floppy_disk: Size: 33.66 KB
:gear: Version: 1.0
:iphone: Minimum API Level: 7
License: Free Extension License
:date: Updated On: 2025-06-12T15:30:00Z
:computer: Built & documented using: FAST-CLI v3.4.0

Blocks

Events:

BigDB has total 7 events.

1. Got

Fires when a value is retrieved

Parameter Type
queryId text
value text

2. KeyList

Fires when a key list is returned

Parameter Type
queryId text
keys any

3. DataChanged

Fires when data changes in the current table

4. ErrorOccurred

Fires when an error occurs

Parameter Type
message text

5. RandomKeyRetrieved

Fires when a random key is retrieved

Parameter Type
queryId text
key text

6. ExpiredKeysRetrieved

Fires when expired keys are retrieved

Parameter Type
queryId text
keys any

7. TableSizeRetrieved

Fires when the table size is retrieved

Parameter Type
queryId text
size number

Methods:

BigDB has total 39 methods.

1. EnableAutoCleanup

Enable or disable auto-cleanup of expired records at the specified interval (in seconds). Set interval to 0 to disable.

Parameter Type
intervalSeconds number

2. PurgeExpired

Purge expired keys from the current table

3. SetPassword

Set database encryption password (PRAGMA key)

Parameter Type
pwd text

4. RemovePassword

Remove encryption (PRAGMA rekey to empty)

5. IsEncrypted

Check if database is encrypted

  • Return type: boolean

6. Store

Store a value for a key with optional TTL and metadata

Parameter Type
key text
value text
useTTL boolean
ttlSeconds number
metadata text

7. Get

Get the value for a key asynchronously

Parameter Type
key text
queryId text

8. Delete

Delete a key

Parameter Type
key text

9. Clear

Clear all data in the current table

10. RenameKey

Rename a key

Parameter Type
oldKey text
newKey text

11. BulkStore

Store multiple key-value pairs

Parameter Type
keys list
values list

12. BulkDelete

Delete multiple keys

Parameter Type
keys list

13. Keys

List all keys in the current table asynchronously

Parameter Type
queryId text

14. Exists

Check if a key exists

  • Return type: boolean
Parameter Type
key text

15. GetRecord

Get full record as JSON asynchronously

Parameter Type
key text
queryId text

16. FindByMetadata

Find keys by metadata substring asynchronously

Parameter Type
query text
queryId text

17. Expire

Set expiry time in seconds for a key

Parameter Type
key text
seconds number

18. SetMetadata

Set metadata for a key

Parameter Type
key text
metadata text

19. GetMetadata

Get metadata for a key

  • Return type: text
Parameter Type
key text

20. GetTTL

Get remaining TTL in seconds for a key (0 if none or expired)

  • Return type: number
Parameter Type
key text

21. GetRandomKey

Get a random key from the current table asynchronously

Parameter Type
queryId text

22. GetExpiredKeys

Get all expired keys from the current table asynchronously

Parameter Type
queryId text

23. SetBulkExpiry

Set the same TTL for multiple keys

Parameter Type
keys list
seconds number

24. CopyTable

Copy the current table to a new table

Parameter Type
targetTable text

25. MergeTables

Merge records from source table into current table

Parameter Type
sourceTable text
conflictStrategy text

26. GetTableSize

Get an estimated size of the current table asynchronously

Parameter Type
queryId text

27. RenameTable

Rename the current table

Parameter Type
newName text

28. DeleteTable

Delete a table

Parameter Type
tableName text

29. CheckTableExists

Check if a table exists

  • Return type: boolean
Parameter Type
tableName text

30. DeleteDatabase

Delete all tables in the database

31. ExportCSV

Export current table as CSV to the specified file path. If filePath is empty, uses the app's external files directory.

Parameter Type
filePath text

32. ImportCSV

Import data into current table from CSV

Parameter Type
filename text

33. ExportJSON

Export current table as JSON string

  • Return type: text

34. ImportJSON

Import data into current table from JSON

Parameter Type
json text

35. Count

Get total record count in current table

  • Return type: number

36. DBSize

Get database file size in bytes

  • Return type: number

37. ListTables

List all tables in database

  • Return type: any

38. Watch

Watch changes to a key in the current table

Parameter Type
key text
queryId text

39. Unwatch

Stop watching changes to a key

Parameter Type
key text
queryId text

Setter:

BigDB has total 1 setter property.

1. SetTable

Set the current table to operate on

  • Input type: text

FAQ

How to set TTL for a key :key: (With TTL as true and false both)

Download the extension! :tada:

This is a big project and I am making it available for free to the community. If you like my work please support here. It will make my day :smile:

Download the latest version from GitHub

All the versions of the extension are available in the Releases tab in the BigDB repository!

Please :star: the Repository to show your support

Please share any feedback below! I will be happy to answer any questions. My other extensions are available here.

Regards
Sarthak Gupta

10 Likes

is this database locally or online?
if locally, why we need to watch the data change event? isn't it changed by yourself?

2 Likes

This database works locally. The 'Data Changed' event is returned whenever Data is changed in the table. The data although changed automatically, the event comes really handy for showing notifiers etc.
The purpose of the extension is to address the limitations of TinyDB combined with the features of SQLite in native android development.

Bulk Store, Bulk Delete, Watching for changes to a key, TTL, Metadata, Encryption, Renaming Keys, Data Export / Import as Json, csv and endless utilities like DBSize, Clear are offered by BigDB

why the data will change automatically?

1 Like

I was referring to the use of a block like BulkStore or BulkDelete. These blocks will change the database and then the DataChanged event will be returned.

Maybe to enforce relational integrity after the fact?

1 Like

BigDB has many features including indexing the database.

Just clarifying, @Kevinkun asked about the Data Changed event and what was its need. I was trying to say that Data is changed as soon as an operation is used like Bulk store and the event is returned indicating the operation to be successful.

6 likes so far! The extension is getting lots of love.
Thanks everyone!

Any features you want to see in the next version.
Drop them below!

How can I set the ttlseconds to infinite?

1 Like

Blind guess... Set useTTL to false?
(Trying to figure out how to set my own TTL)

1 Like

Because TTL offers security, can I have it active and have infinite time?

1 Like

How to set the value of TTL for a key to infinite?

There are 3 possible methods.

  1. Set useTTL to false.
  2. Set useTTL to true and set the TTL to a very large num
  1. Using the Expire Key method with a value less than or equal to 0.
    First create a key following the second method then, use the Expire block with the key name and set the value of seconds to any -ve value or 0.

Extensions, Tutorials and Resources from Sarthak Gupta

.

1 Like

Okay then, but I wasn't sure if it was possible to have TTL and infinite time at the same time. Thanks!

1 Like

It's possible with method 3 using the expire key block. Welcome

1 Like

:rocket: BigDB v1.1 is here!

:package: Version: 1.1
:date: Release Date: Thursday, June 12, 2025
:alarm_clock: Time: 2025-06-12T16:27:00Z


:compass: Overview

This release supercharges BigDB with powerful new features designed to enhance its already robust key-value storage capabilities—TTL, metadata, multi-table support, encryption, export/import, and now:

  • :white_check_mark: Automatic Cleanup of Expired Records
  • :toolbox: Advanced Table & Key Utilities
  • :bar_chart: Better Monitoring & Maintenance Tools

These updates make BigDB more versatile, efficient, and developer-friendly, perfect for App Inventor projects of all types!


:sparkles: New Features

:arrows_counterclockwise: Auto-Cleanup of Expired Records

:new: Block: EnableAutoCleanup(int intervalSeconds)

:receipt: Description:
Automatically purges expired records at a specified interval using their TTL values.

:hammer_and_wrench: How It Works:

  • EnableAutoCleanup(300) → Clean every 5 minutes
  • EnableAutoCleanup(0) → Disable cleanup
  • :brain: Settings persist via SharedPreferences
  • :repeat: Internally uses a Handler to schedule PurgeExpired

:dart: Use Case:
Auto-manage temp data like session tokens or cached results.

:gear: Event Triggered: DataChanged after every cleanup

:jigsaw: How This Works:
  • A new DataFormat enum with dropdown support (json or csv) was introduced.
  • CSV generation and parsing is handled by helper functions (generateCSV, importFromCSVString).
  • Reuses logic from previous import/export blocks for compatibility and reliability.

:toolbox: New Utility Methods

:key: GetRandomKey(String queryId)

→ Returns: Random non-expired key
→ Event: RandomKeyRetrieved(queryId, key)
:video_game: Use Case: Random selection for quizzes/games


:hourglass_flowing_sand: GetExpiredKeys(String queryId)

→ Returns: Array of expired keys
→ Event: ExpiredKeysRetrieved(queryId, keys[])
:broom: Use Case: Auditing stale records for cleanup


:calendar: SetBulkExpiry(YailList keys, int seconds)

→ Sets TTL for multiple keys at once
→ Event: DataChanged
:arrows_counterclockwise: Uses transactions for atomicity
:dart: Use Case: Managing sessions or temporary keys in bulk


:clipboard: CopyTable(String targetTable)

→ Copies current table to a new one
→ Fails if table already exists
→ Event: DataChanged
:package: Use Case: Backup/archive before data edits


:link: MergeTables(String sourceTable, String conflictStrategy)

→ Merges one table into another
→ Event: DataChanged
:control_knobs: Strategy:

  • "overwrite": Replace existing keys
  • "ignore": Skip if key exists
    :dna: Use Case: Merging user data from different sources

:straight_ruler: GetTableSize(String queryId)

→ Estimates table size (bytes)
→ Event: TableSizeRetrieved(queryId, size)
:bar_chart: Use Case: Alert users of large table size


:pencil2: RenameTable(String newName)

→ Renames current table
→ Fails if name exists
→ Event: DataChanged
:file_folder: Use Case: Reorganizing tables during app updates


:wastebasket: DeleteTable(String tableName)

→ Deletes specified table
→ Switches to data_table if current is deleted
→ Event: DataChanged
:soap: Use Case: Removing obsolete data


:mag: CheckTableExists(String tableName)

→ Returns: true/false
:white_check_mark: Use Case: Validation before operations


:bomb: DeleteDatabase()

→ Deletes all tables, recreates data_table
→ Event: DataChanged
:arrows_counterclockwise: Use Case: Reset during development/testing


:blue_book: Usage Instructions

:arrows_counterclockwise: Auto-Cleanup

  • Enable with EnableAutoCleanup(seconds)
  • Disable with EnableAutoCleanup(0)
  • :repeat: Auto-persisted across sessions

:brain: Asynchronous Methods

  • GetRandomKey → RandomKeyRetrieved
  • GetExpiredKeys → ExpiredKeysRetrieved
  • GetTableSize → TableSizeRetrieved

:zap: Synchronous Methods

  • SetBulkExpiry, CopyTable, MergeTables, RenameTable, DeleteTable, CheckTableExists, DeleteDatabase
    → Fire DataChanged on success
    → Fire ErrorOccurred on failure

:hammer_and_wrench: MergeTables Conflict Resolution

  • "overwrite" → Replace keys
  • "ignore" → Keep existing keys

:brick: Table Management

  • DeleteTable and DeleteDatabase ensure default data_table exists afterward

:pushpin: Additional Notes

  • :white_check_mark: No Breaking Changes – All updates are fully backward-compatible
  • :rocket: Performance Optimized – Uses indices and transactions
  • :thread: Asynchronous Handling – Keeps UI responsive via AsyncTask
  • :shield: Robust Error Handling – Clear messages via ErrorOccurred
  • :package: Zero Dependencies – Lightweight and self-contained

Download link is updated at the top.

:pray: Thank You!

Your support drives the growth of BigDB. These new features bring automation, efficiency, and control to your app's data management. I am excited to hear your feedback and keep improving!


Do check out my other extensions here at https://ai2.sarthakdev.in/

You should update your first post with the new blocks and information.

1 Like

Done

:loudspeaker:BigDB v1.2 is here!

:compass: Overview

This release supercharges BigDB with powerful new features designed to enhance its already robust key-value storage capabilities—TTL, metadata, multi-table support, encryption, export/import, and now:

  • :toolbox: Advanced Table & Key Utilities
  • :bar_chart: Easier Data Maintainance

ExportToString_Get_Method
ExportToFile_Call_Method
ImportFromFile_Call_Method
ImportFromString_Call_Method

New Features

  1. Added new blocks ImportFromFile and ExportToFile with dropdown for file types like json, csv and sqlite db.
  2. Added new blocks ImportFromString and ExportToString with dropdown for file types like json and csv.

Bug Fixes

  1. Manifest file permissions updated
  2. Improved Performance on old devices

Deprecated
Old blocks for Json and csv import/export.

Download the extension directly from Github Releases tab!

:pray: Thank You!

Your support drives the growth of BigDB. These new features bring automation, efficiency, and control to your app's data management. I am excited to hear your feedback and keep improving!


Do check out my other extensions here at https://ai2.sarthakdev.in/

1 Like

Please follow the naming conventions also for the helper blocks

JSON --> Json

Taifun

2 Likes