-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
Find way for accessing SQlite DB programmatically #1690
Comments
Re the idea of isolating the Out of curiosity, I ran a quick-and-dirty POC on this branch. With this, you could do the following on the command line:
For that, we’d have to refactor the Execution time on device (including activating |
Resolves #1524. The outcome of our discussion in the ticket was this: - The SQlite DB (`tinypilot.db`) should be the default place for new settings, whereas the YAML file (`settings.yml`) should only be used in exceptional cases, and obviously for legacy reasons. - We favor having a single storage solution over a dual approach, as that simplifies future decision-making, and eliminates potential migration burden between the two storage formats. - The SQlite DB doesn’t easily allow programmatic access right now (in contrast to the YAML file), so we [created this ticket for removing this hurdle](#1690). - We [will document the parameters in `settings.yml` separately](#1573). This PR adds a comment in `settings.py`, marking its usage as quasi-deprecated. It also adds some historical context, references the SQlite DB as default storage, and lists sample exceptional cases. I realized that we probably don’t need to add any documentation to the SQlite DB, since there is not really an alternative to it any longer. So by deprecating `settings.yml`, the SQlite DB is the only storage option anyway, and there shouldn’t be any ambiguity left. Contrary to [my initial proposal](#1524 (comment)), I also don’t think we should move `settings.py` up to the `app` package, as that might mistakenly promote its usage. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1692"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a> --------- Co-authored-by: Jan Heuermann <jan@jotaen.net>
In #1524, we discussed that we should make it easier to use the SQlite /
tinypilot.db
file in programmatic contexts, e.g. in bash scripts.Currently, you have to add a CLI endpoint to the Flask app (see, this example, where we read the streaming mode). This has some downsides:
Note that we can’t “naively” read from the
tinypilot.db
file as is, since the DB file might not be in the latest migration state. We probably don’t want to port our migration logic to a different language.So we should explore options to access the
tinypilot.db
file in programmatic contexts. Requirements for the solution:db.settings.Settings().get_streaming_mode().value
is ~5ms on device (which includes reading the DB file from disk).Potential solutions / approaches:
(Non-exhaustive, just as starting points)
app.db
module in a way that we can write our own, Flask-less CLI entry point.The text was updated successfully, but these errors were encountered: