All Projects → simonw → sqlite-generate

simonw / sqlite-generate

Licence: Apache-2.0 License
Tool for generating demo SQLite databases

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to sqlite-generate

healthkit-to-sqlite
Convert an Apple Healthkit export zip to a SQLite database
Stars: ✭ 130 (+550%)
Mutual labels:  sqlite, datasette-io, datasette-tool
pocket-to-sqlite
Create a SQLite database containing data from your Pocket account
Stars: ✭ 56 (+180%)
Mutual labels:  sqlite, datasette-io, datasette-tool
google-takeout-to-sqlite
Save data from Google Takeout to a SQLite database
Stars: ✭ 73 (+265%)
Mutual labels:  datasette-io, datasette-tool
Datasette
An open source multi-tool for exploring and publishing data
Stars: ✭ 5,640 (+28100%)
Mutual labels:  sqlite, datasette-io
dogsheep-photos
Upload your photos to S3 and import metadata about them into a SQLite database
Stars: ✭ 156 (+680%)
Mutual labels:  datasette-io, datasette-tool
geojson-to-sqlite
CLI tool for converting GeoJSON files to SQLite (with SpatiaLite)
Stars: ✭ 41 (+105%)
Mutual labels:  datasette-io, datasette-tool
evernote-to-sqlite
Tools for converting Evernote content to SQLite
Stars: ✭ 28 (+40%)
Mutual labels:  datasette-io, datasette-tool
django-sql-dashboard
Django app for building dashboards using raw SQL queries
Stars: ✭ 369 (+1745%)
Mutual labels:  datasette-io, datasette-tool
dbf-to-sqlite
CLI tool for converting DBF files (dBase, FoxPro etc) to SQLite
Stars: ✭ 31 (+55%)
Mutual labels:  datasette-io, datasette-tool
sqlite-dotnet-core
.NET Core 2.1 Console Application using SQLite with Entity Framework and Dependency Injection
Stars: ✭ 17 (-15%)
Mutual labels:  sqlite
yaramanager
Simple yara rule manager
Stars: ✭ 60 (+200%)
Mutual labels:  sqlite
aiosqlite3
sqlite3 on asyncio use loop.run_in_executor proxy
Stars: ✭ 21 (+5%)
Mutual labels:  sqlite
italy
Free open public domain football data (football.db) for Italy / Europe - Serie A etc.
Stars: ✭ 35 (+75%)
Mutual labels:  sqlite
sqlite-vtfunc
Implement SQLite table-valued functions with Python
Stars: ✭ 45 (+125%)
Mutual labels:  sqlite
cpplipa
C++ library package
Stars: ✭ 17 (-15%)
Mutual labels:  sqlite
Rezoom.SQL
Statically typechecks a common SQL dialect and translates it to various RDBMS backends
Stars: ✭ 639 (+3095%)
Mutual labels:  sqlite
librdf.sqlite
♊️ Mirror of https://code.mro.name/mro/librdf.sqlite | 🛠 improved SQLite RDF triple store for Redland librdf
Stars: ✭ 21 (+5%)
Mutual labels:  sqlite
csv-to-sqlite
A desktop app to convert CSV files to SQLite databases!
Stars: ✭ 68 (+240%)
Mutual labels:  sqlite
chiselstore
SQLite + Little Raft = 🚀
Stars: ✭ 398 (+1890%)
Mutual labels:  sqlite
INTER-Mediator
The new style web application framework, you could develop a db-driven web application with declarative descriptions.
Stars: ✭ 27 (+35%)
Mutual labels:  sqlite

sqlite-generate

PyPI Changelog License

Tool for generating demo SQLite databases

Installation

Install this plugin using pip:

$ pip install sqlite-generate

Demo

You can see a demo of the database generated using this command running in Datasette at https://sqlite-generate-demo.datasette.io/

The demo is generated using the following command:

sqlite-generate demo.db --seed seed --fts --columns=10 --fks=0,3 --pks=0,2

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 use the --tables option to generate a different number of tables:

sqlite-generate data.db --tables 20

You can run the command against the same database file multiple times to keep adding new tables, using different settings for each batch of generated tables.

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 --rows 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

--columns can also accept a range:

sqlite-generate data.db --columns 5,15

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

Each table will have a single primary key column called id. You can use the --pks= option to change the number of primary key columns on each table. Drop it to 0 to generate rowid tables. Increase it above 1 to generate tables with compound primary keys. Or use a range to get a random selection of different primary key layouts:

sqlite-generate data.db --pks=0,2

To configure SQLite full-text search for all columns of type text, use --fts:

sqlite-generate data.db --fts

This will use FTS5 by default. To use FTS4 instead, use --fts4.

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].