Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlite abstraction #12

Closed
BenHenning opened this issue Aug 2, 2019 · 7 comments
Closed

Sqlite abstraction #12

BenHenning opened this issue Aug 2, 2019 · 7 comments
Labels
Priority: Essential This work item must be completed for its milestone. Z-ibt Temporary label for Ben to keep track of issues he's triaged.

Comments

@BenHenning
Copy link
Member

Sqlite is the database storage option of choice, and given the large variety of data being stored in the Oppia app this is an ideal database system to use. However, the relational and join/query-based nature of the RDBMS should be abstracted into a simple RESTful interface that only exposes the shared data models used in higher layers of the app (see section 4.5 of the app architecture design document). This abstraction needs to force all operations to be performed off the main thread, with multithreading enabled.

If transactions are required here or in the future, this abstraction should expose them via a Closeable interface. The abstraction itself may need to enforce transactions if the regular RESTful interface is used instead.

The abstraction also needs to consider app upgrades: the database may need to be upgraded if a new structure is used in the later app version, and data may need to be appropriately moved over. This flow should be completely hidden from callers, though the cost of actually upgrading the database will likely be included in the futures waiting on the database operation to complete.

The abstraction needs to support approximate the size of certain entities despite them potentially being split across multiple tables.

This abstraction should be compatible with the data source system implemented in #6.

@BenHenning BenHenning added Type: Improvement Priority: Essential This work item must be completed for its milestone. labels Aug 2, 2019
@BenHenning BenHenning added this to the Prototype milestone Aug 2, 2019
@BenHenning
Copy link
Member Author

This is blocked on #4 and #6.

@BenHenning BenHenning changed the title Sqlite abstraction Sqlite abstraction [Blocked: #4, #6] Aug 12, 2019
@BenHenning
Copy link
Member Author

Recommend looking at introduce-data-module for the basis of infrastructure that we should use when designing this.

@BenHenning
Copy link
Member Author

From meeting, we need a design document here that includes:

  1. How we will be abstracting sqlite behind the data source infrastructure being introduced in introduce-data-module
  2. An initial schema & CRUD API representing the new data objects being introduced in @rt4914's GAE abstractions

@BenHenning BenHenning changed the title Sqlite abstraction [Blocked: #4, #6] Sqlite abstraction [Blocked: #6] Sep 5, 2019
@BenHenning BenHenning modified the milestones: Prototype, Minimal Viable Product Sep 9, 2019
@BenHenning BenHenning changed the title Sqlite abstraction [Blocked: #6] Sqlite abstraction Sep 17, 2019
@BenHenning
Copy link
Member Author

We decided to push this to MVP since we can just use #7 for local storage instead of a heavier weight sqlite solution.

@PrarabdhGarg
Copy link
Contributor

@BenHenning if you are still considering sqllite abstraction, I would like to recommend the room library. It supports transactions, multi-threading, RESTful interface as well as migrations. It also automatically protects the app against SQL Injection attacks, and is recommended by Google itself for offline data caching.

@BenHenning BenHenning modified the milestones: Minimal Viable Product, Global Availability Jun 23, 2020
@BenHenning BenHenning added this to the Beta milestone Jun 23, 2020
@anandwana001
Copy link
Contributor

@BenHenning
Copy link
Member Author

Proto DataStore is probably a viable replacement for PersistentCacheStore, but that may take some time for us to make the move. :) Probably better to wait.

@PrarabdhGarg we would definitely use Room if we went with Sqlite. However it seems more clear at this point that a relational system would be a substantial amount of work for little gain. This is no longer the plan for download storage, so closing this.

@BenHenning BenHenning added the Z-ibt Temporary label for Ben to keep track of issues he's triaged. label Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Essential This work item must be completed for its milestone. Z-ibt Temporary label for Ben to keep track of issues he's triaged.
Development

No branches or pull requests

4 participants