gitmyhub

sqlbrite

Java ★ 4.5k updated 5y ago ▣ archived

A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations.

SQL Brite was a Java library for Android that made it easier to work with SQLite databases in a reactive way. The core idea was that instead of manually querying the database every time you needed fresh data, you could subscribe to a query and automatically receive a new result whenever the underlying table changed. This removed the need to manually track when to refresh UI or other components after a write operation.

The library wrapped Android's standard SQLite helper with a thin layer that connected it to RxJava, a popular framework for reactive programming. When you ran a query through SQL Brite, you got back an observable stream rather than a one-time result. Any insert, update, or delete made through the same SQL Brite database object would automatically trigger a new emission on any active query subscriptions watching the affected tables.

To avoid flooding subscribers with rapid-fire updates during bulk operations, the library supported transactions. Grouping multiple writes inside a transaction meant subscribers received only one notification when the whole batch completed, rather than one per write.

SQL Brite was intentionally narrow in scope. It handled only the notification and coordination layer. It was not an ORM, did not generate type-safe queries, and did not handle database migrations.

The library is no longer actively maintained and is considered complete. The README directs users who want its database features to SQLDelight, which is a more full-featured successor. For watching Android content providers specifically, the README points to a separate library called Copper.