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

Command for creating an empty database #348

Closed
simonw opened this issue Nov 30, 2021 · 6 comments
Closed

Command for creating an empty database #348

simonw opened this issue Nov 30, 2021 · 6 comments
Labels
cli-tool enhancement New feature or request
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Nov 30, 2021

I sometimes find the need to create an empty SQLite database file - for example if I want to enable WAL on it before using it with another script. I currently do that like this:

sqlite3 my.db vacuum
sqlite-utils enable-wal my.db

It would be nice if sqlite-utils had a convenience command for doing this.

@simonw simonw added enhancement New feature or request cli-tool labels Nov 30, 2021
@simonw
Copy link
Owner Author

simonw commented Nov 30, 2021

Maybe this:

sqlite-utils create-database my.db

With options that include --enable-wal (actually that's the only option I can think of).

This is consistent with the existing create-table and create-view commands.

@simonw
Copy link
Owner Author

simonw commented Nov 30, 2021

Potential other options could include:

@eyeseast
Copy link
Contributor

eyeseast commented Dec 1, 2021

I'd use this. Right now, I tend to do touch my.db and then enable-wal or whatever else, but I'm never sure if that's a bad idea.

@simonw
Copy link
Owner Author

simonw commented Jan 9, 2022

I'm not going to implement --page-size unless someone specifically requests it - I don't like having features that I've never needed to use myself.

@simonw simonw closed this as completed in 1d64cd2 Jan 9, 2022
@simonw
Copy link
Owner Author

simonw commented Jan 9, 2022

@simonw simonw added this to the 3.21 milestone Jan 10, 2022
simonw added a commit that referenced this issue Jan 11, 2022
simonw added a commit that referenced this issue Jan 11, 2022
@simonw
Copy link
Owner Author

simonw commented Jan 13, 2022

Wrote a lot more about this feature here: https://simonwillison.net/2022/Jan/12/how-i-build-a-feature/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli-tool enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants