Skip to main content

Tool for generating demo SQLite databases

Project description

sqlite-generate

PyPI Changelog License

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

By default each table will contain between 0 and 2 foreign key columns to other tables. You can control this using the --fks option, with either a single number or a range:

sqlite-generate data.db --columns=20 --fks=5,15

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

sqlite-generate-0.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

sqlite_generate-0.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file sqlite-generate-0.4.tar.gz.

File metadata

  • Download URL: sqlite-generate-0.4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for sqlite-generate-0.4.tar.gz
Algorithm Hash digest
SHA256 4a74a6ab925806649d042c62327164c22ca4521fa56e928f9f91b6c1c55ee226
MD5 b31f8d1e92a5c329d4cfbbeaa2b78451
BLAKE2b-256 88aa10d7cb3f4f9c192502968e9a746194da285b0141f0681f1bc910a92c9a6b

See more details on using hashes here.

File details

Details for the file sqlite_generate-0.4-py3-none-any.whl.

File metadata

  • Download URL: sqlite_generate-0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for sqlite_generate-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a30a30b3781d0d4c9643b4dc160de7d3c410faf692f7dae3bdd8284d749913bc
MD5 c2a7e62242b115da05452cd2bc737fbe
BLAKE2b-256 a4910b7c41ae0299b7cdc865a2a3a24b234b4d3a22d9e17f4975bcd60236ec56

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page