Tool for generating demo SQLite databases
Project description
sqlite-generate
Tool for generating demo SQLite databases
Installation
Install this plugin using pip
:
$ pip install sqlite-generate
Usage
To generate a SQLite database file called data.db
with 10 randomly named tables in it, run the following:
sqlite-generate data.db
You can see a demo of the database generated using this command running in Datasette at https://sqlite-generate-demo.datasette.io/
You can use the --tables
option to generate a different number of tables:
sqlite-generate data.db --tables 20
By default each table will contain a random number of rows between 0 and 200. You can customize this with the --rows
option:
sqlite-generate data.db --rows 20
This will insert 20 rows into each table.
sqlite-generate data.db --tables 500,2000
This inserts a random number of rows between 500 and 2000 into each table.
Each table will have 5 columns. You can change this using --columns
:
sqlite-generate data.db --columns 10
You can control the random number seed used with the --seed
option. This will result in the exact same database file being created by multiple runs of the tool:
sqlite-generate data.db --seed=myseed
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd sqlite-generate
python -mvenv venv
source venv/bin/activate
Or if you are using pipenv
:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sqlite_generate-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3a778e4af9f82dea80d927a75211f2a9be0122c860c1f0775207fac9e077845 |
|
MD5 | 39f53af0f7a628c4b53dd0a6b89c54ec |
|
BLAKE2b-256 | f3acd903b3606ada238e3aa2cfd6590528f519bd254a34d40fe5132b040f7e01 |