A mock MySQL server that generates junk data based on your schema.
Project description
Mocks DB
Mocks DB is a lightweight, mock MySQL server designed for testing and development. It accepts any standard MySQL connection and query, but instead of storing data, it generates realistic "junk" data on the fly based on your provided schema.
Perfect for performance testing, UI development, or any scenario where you need a database that acts like the real thing but populates itself.
Features
- MySQL Protocol Support: Connect with any standard MySQL client (CLI, Workbench, generic libraries).
- Dynamic Data Generation: Uses Faker to generate realistic data based on column types.
- Schema Awareness: define your table structures via standard
CREATE TABLEstatements. - Configurable: Control row counts, limits, and random seeds.
- Zero Storage: No disk I/O for data, everything is generated in memory on demand.
Installation
pip install mocks-db
Usage
Run the server with a file:
mocks-db --schema schema.sql --port 3306
Or pass the schema directly as a string:
mocks-db --schema-content "CREATE TABLE users (id INT, name VARCHAR(255));" --port 3306
Connect with your favorite client:
mysql -h 127.0.0.1 -P 3306 -u root
Run queries:
SELECT * FROM users LIMIT 10;
Development
To develop and test locally without installing from a remote repository:
-
Clone the repo (if you haven't already).
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies and the package in editable mode:
pip install -e .
-
Run the server:
mocks-db --schema-content "CREATE TABLE test (id INT);"
Or run efficiently via python module:
python -m mocks_db.main --help
-
Install development dependencies and run tests:
This project uses
pyproject.tomlfor dependency management. You can install the package along with development dependencies (like pytest) using the[dev]extra:pip install -e ".[dev]"
Or use the legacy requirements style:
pip install -r requirements-dev.txt
Then run tests:
pytest
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mocks_db-0.1.0.tar.gz.
File metadata
- Download URL: mocks_db-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7df413762b32d7d6082fbfb082af72ef138ef4536093d4e33153d3cc63bebdd1
|
|
| MD5 |
c98618bbcc1474d2b79dcb8234e1e6bd
|
|
| BLAKE2b-256 |
e488e90552c9d5ddd75ccd5ed94cf6de74bce3c29380ce515635b1971b1853c8
|
Provenance
The following attestation bundles were made for mocks_db-0.1.0.tar.gz:
Publisher:
publish.yml on prat31/mocks-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mocks_db-0.1.0.tar.gz -
Subject digest:
7df413762b32d7d6082fbfb082af72ef138ef4536093d4e33153d3cc63bebdd1 - Sigstore transparency entry: 871759489
- Sigstore integration time:
-
Permalink:
prat31/mocks-db@9f50813d3f95abef9ab4843ebf15922afd2e7a83 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/prat31
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f50813d3f95abef9ab4843ebf15922afd2e7a83 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mocks_db-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mocks_db-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d402edc882613076f51ec8d2af551e4f99d1c0d211ddf371af96811961d66627
|
|
| MD5 |
4b6eb0d1811ced253e32c4d13a48bae4
|
|
| BLAKE2b-256 |
fde8d7da259d666d64753b87a54cabd80e2e6fa23dad9cf34b0114e0cedfb62a
|
Provenance
The following attestation bundles were made for mocks_db-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on prat31/mocks-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mocks_db-0.1.0-py3-none-any.whl -
Subject digest:
d402edc882613076f51ec8d2af551e4f99d1c0d211ddf371af96811961d66627 - Sigstore transparency entry: 871759536
- Sigstore integration time:
-
Permalink:
prat31/mocks-db@9f50813d3f95abef9ab4843ebf15922afd2e7a83 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/prat31
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f50813d3f95abef9ab4843ebf15922afd2e7a83 -
Trigger Event:
release
-
Statement type: