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

[feqture request] sql: Support loading databases from bundled resources #1155

Open
kisaragi-hiu opened this issue Apr 7, 2024 · 0 comments
Labels
enhancement New feature or request plugin: sql

Comments

@kisaragi-hiu
Copy link

Why

Uses of SQLite can be categorized into two ways: reading and writing complex application state, and reading from an existing dataset. AFAIK this is OLTP and OLAP, respectively.

For complex state, it is appropriate for the file to be created and managed in appDataDir. However, for the case where the developer is bringing existing data to query (and only needs read-only access), it should be possible to access a database file as a resource directly. Right now, plugin-sql does not allow this.

(This situation happens in other frameworks as well, where the sqlite adapter does not provide read-only access to bundled databases. The common, and I'd argue ugly, work around is to copy the bundled database to appDataDir's equivalents, doubling the storage use for no good reason.)

TL;DR and proposed solution

It would be nice if plugin-sql provides read-only access to sqlite databases bundled as resources. This can be done, perhaps, by having plugin.rs recognize a different type, perhaps sqlite-resource:<path>, where path is resolved as a resource and errors if it doesn't exist.

This should not have safety implications, I think, as it only allows the developer to decide to access bundled resources.

@FabianLars FabianLars added enhancement New feature or request plugin: sql labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin: sql
Projects
None yet
Development

No branches or pull requests

2 participants