Skip to main content

A Python library for seeding databases with random realistic test data.

Project description

FakeReal

Overview

FakeReal is a Python library designed to populate MySQL, PostgreSQL, and SQLite databases with random test data. With FakeReal, you can easily generate and insert fake but realistic data into your databases, either for testing or for other purposes. It's built on top of the Faker library for generating the data and uses Peewee for database connectivity.

Features

  • Multiple Database Support: FakeReal supports MySQL, PostgreSQL, and SQLite databases.
  • Intuitive API: FakeReal provides an easy-to-use API for seeding databases and running test queries.
  • Customizable Data Generation: Auto-generates realistic data based on your database schema, semantics of fields, and relationship between the tables.
  • Wipe Test Data: Provides the ability to wipe test data from databases.

Installation

You can install FakeReal via pip:

pip install fakereal

Quick Start

Pre-requisites

Before diving into FakeReal, create a sample database named OnlineStore:

mysql -u root -p < onlineStoreDB.sql

Seed Your Database

Here's a Python script to quickly get you started with FakeReal:

from fakereal import fakereal

# Initialize FakeReal with a connection string
connection_string = 'mysql://root:@localhost:3306/OnlineStore'
FakeReal = fakereal(connection_string)

# Seed 'all' tables with 100 rows each, in batches of 10
FakeReal.seed('all', rows=100, batch_size=10)

# Run test queries and print the result
result = FakeReal.test_queries(return_bool=True, silent=False)
print(result)

Contributing

Contributions are welcome!

License

This project is open source.

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

fakereal-0.2.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

fakereal-0.2.1-py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 3

Supported by

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