Skip to content

support create sqlite3 database? #1948

Answered by freakboy3742
Jzhenli asked this question in Q&A
Discussion options

You must be logged in to vote

There should be no problem reading, writing or creating SQLite databases - provided you name a file location that is writable.

On Android, the current working directory isn't writable; if you specify a filename without a fully qualified path, it will be interpreted relative to the current working directory, which will cause errors.

If you're using Toga, the app object has a paths attribute that contains a collection of base paths you can use to build a writable filename (eg self.paths.data / "my.db" in your startup method will describe a database file in the user's "data" folder. You may need to create that folder first with mkdir; but once it exists, the file will be writable.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Jzhenli
Comment options

@mhsmith
Comment options

mhsmith Aug 12, 2024
Collaborator

Answer selected by Jzhenli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants