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

Better abstraction around hosted databases (SQLite, DuckDB, etc.) #426

Open
marcua opened this issue Aug 11, 2024 · 0 comments
Open

Better abstraction around hosted databases (SQLite, DuckDB, etc.) #426

marcua opened this issue Aug 11, 2024 · 0 comments

Comments

@marcua
Copy link
Owner

marcua commented Aug 11, 2024

  • The hosted_db module doesn't abstract away database functionality much, and breaks the abstraction in a few places
    • In the main hosted_db.rs, there is a run_query that matches on db_type. We only support one DB type for now (SQLite), and so this function throws an error for any other db_type.
    • The SQLite-specific code does a mix of handling sandboxing (something that shouldn't be DB-specific) and SQLite-specific querying
    • Sandboxing assumed you're running queries on SQLite with no abstraction
  • Outside of the querying logic, there's also server::snapshots::execution, which calls directly into the SQLite backup facilities. Ideally that would also be in some form of abstraction.
  • All of this adds up to
    • Create a HostedDb trait (like ayb_db::db_interfaces::AybDb)
    • Specific implementations like SqliteHostedDb and DuckDbHostedDb would then implement query (with safe/unsafe variants) and backup
    • Isolation should be orthogonal to the HostedDb. Perhaps the query code in the HostedDb can pass whatever information it needs to an isolated context to run inside of it.
@marcua marcua converted this from a draft issue Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To do
Development

No branches or pull requests

1 participant