emirozer

fake2db: Generate Test Databases with Fake Data

fake2db generates databases populated with realistic-looking data for development and testing. It supports several SQL and NoSQL backends, with options for row counts, locales, repeatable seeds, and custom fields.

PythonGPL-2.0DatabaseTestingCLI
Stars
2.3k
Forks
119
Stars, last 10 days
-2

Our take

Health score

25/100

How it is scored
Activity
20
Community
38
Issues
21
Pull requests
21

-2 stars in the last 10 days

Overview

fake2db is a Python command-line tool for creating databases populated with fake but valid data. It helps developers and testers work with populated datasets without manually creating records or using production data.

It supports SQLite, MySQL, PostgreSQL, MongoDB, Redis, and CouchDB. Use it when you need a quick dataset for local development, test runs, or database demonstrations, rather than a general-purpose data migration or production database tool.

Key Features

  • Generates data for six database types: SQLite, MySQL, PostgreSQL, MongoDB, Redis, and CouchDB.
  • Sets the number of rows to generate with --rows.
  • Can generate data in a selected locale, with en_US as the default.
  • Accepts a seed to reproduce generated datasets, though UUID values remain random.
  • Allows custom fields through the --custom option and supported data types.
  • Supports optional database names and connection settings such as host, port, username, and password.
  • Can be used with the FoundationDB SQL Layer through the PostgreSQL generator and SQL Layer port.

Use Cases

  • Developers can populate a local database with sample records while building an application.
  • Test engineers can prepare datasets for database integration tests without using real customer information.
  • Educators and tutorial authors can create populated databases for exercises and demonstrations.
  • Teams evaluating database-backed tools can generate data across supported SQL and NoSQL systems.

Getting Started

Install from PyPI and generate a sample SQLite database:

pip install fake2db
fake2db --rows 200 --db sqlite

See the README for backend-specific dependencies, connection options, and custom generation details.

Alternatives

  • mimesis: Mimesis is a Python data-generation library for building records and datasets; fake2db focuses on populating supported databases directly.
  • factory_boy: factory_boy builds test objects through configurable factories and ORM integrations, rather than generating populated databases through a standalone CLI.
  • mixer: Mixer generates test instances for Python models and can save them through an ORM, while fake2db seeds databases across SQL and NoSQL backends.
ProjectLanguageLicenseStarsStatus
fake2dbPythonGPL-2.02.3kNot checked yet
mimesisPythonMIT4.8kActive
factory_boyPythonMIT3.8kQuiet
mixerPythonOther954Inactive

Considerations

  • Database drivers are optional and must be installed separately for the relevant backends. PostgreSQL also requires pg_config to install psycopg2.
  • Seeded runs are not fully deterministic because UUID values remain random.
  • The repository was last pushed on 2019-11-25, so check compatibility with current Python versions, database servers, and drivers before adopting it.
  • The GPL-2.0 license may affect how the software can be incorporated or redistributed.

Found this useful?

Share it with someone who would like fake2db.

Comparisons