Skip to main content

Mocks DB

License Python

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 TABLE statements.
  • 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:

  1. Clone the repo (if you haven't already).

  2. Create a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install dependencies and the package in editable mode:

    pip install -e .
    
  4. Run the server:

    mocks-db --schema-content "CREATE TABLE test (id INT);"
    

    Or run efficiently via python module:

    python -m mocks_db.main --help
    
  5. Install development dependencies and run tests:

    This project uses pyproject.toml for 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

MIT

Metadata

Release files for mocks-db 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mocks-db 0.1.0
File Size Uploaded Provenance Actions
mocks_db-0.1.0.tar.gz 9.7 kB With provenance Details for mocks_db-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mocks-db 0.1.0
File Interpreter ABI Platform Actions
mocks_db-0.1.0-py3-none-any.whl Python 3 none any Details for mocks_db-0.1.0-py3-none-any.whl

Total release size: 18.4 kB

Release files / mocks_db-0.1.0.tar.gz

Download URL mocks_db-0.1.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7df413762b32d7d6082fbfb082af72ef138ef4536093d4e33153d3cc63bebdd1
BLAKE2b-256 checksum
How to use checksums
e488e90552c9d5ddd75ccd5ed94cf6de74bce3c29380ce515635b1971b1853c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

Release files / mocks_db-0.1.0-py3-none-any.whl

Download URL mocks_db-0.1.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d402edc882613076f51ec8d2af551e4f99d1c0d211ddf371af96811961d66627
BLAKE2b-256 checksum
How to use checksums
fde8d7da259d666d64753b87a54cabd80e2e6fa23dad9cf34b0114e0cedfb62a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

Security for mocks-db 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mocks_db-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page