Skip to main content

A mock MySQL server that generates junk data based on your schema.

Project description

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

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

mocks_db-0.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mocks_db-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

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

Hashes for mocks_db-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7df413762b32d7d6082fbfb082af72ef138ef4536093d4e33153d3cc63bebdd1
MD5 c98618bbcc1474d2b79dcb8234e1e6bd
BLAKE2b-256 e488e90552c9d5ddd75ccd5ed94cf6de74bce3c29380ce515635b1971b1853c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for mocks_db-0.1.0.tar.gz:

Publisher: publish.yml on prat31/mocks-db

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for mocks_db-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d402edc882613076f51ec8d2af551e4f99d1c0d211ddf371af96811961d66627
MD5 4b6eb0d1811ced253e32c4d13a48bae4
BLAKE2b-256 fde8d7da259d666d64753b87a54cabd80e2e6fa23dad9cf34b0114e0cedfb62a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mocks_db-0.1.0-py3-none-any.whl:

Publisher: publish.yml on prat31/mocks-db

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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