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 details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file fakereal-0.2.1.tar.gz.

File metadata

  • Download URL: fakereal-0.2.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for fakereal-0.2.1.tar.gz
Algorithm Hash digest
SHA256 03384f17a5f44c59fbd767581b40e456047010dd7f1748447b426672abfd1443
MD5 f6ea231144968991b9c58278b1aa447b
BLAKE2b-256 5665e2b02b780a6c40495c9bb260425f39f901843326ca9edee83b7787a9802b

See more details on using hashes here.

File details

Details for the file fakereal-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: fakereal-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for fakereal-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e03d12d3785c48d6c0f607f8cd1eac06650c72e6bedeb4b1ef4d55dc391a878f
MD5 b612d8123192a860dae578e60f266945
BLAKE2b-256 8883565772c0a7b3776600a686c16432d04b3aa31bc8c2957855210eb0ddc98c

See more details on using hashes here.

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