Skip to main content

dammy

GitHub top language Documentation Status Travis (.org) Codacy Badge Maintainability PyPI download month PyPI download week PyPI download day

Generate fake/dummy data for any purpose

Table of contents

Introduction

dammy is a powerful and simple tool to generate fake data. You can use it to mock classes, populate databases and and much more. You can check the full documentation here.

Features

  • Generate anything within the set of prebuilt objects (Person names, country names, car manufacturers and models, random dates...)
  • Compose more complex data easily (Full profiles, complete databases, )
  • The possibility to expand the previous set with little to no code
  • Completely intuitive, you will learn to use it in less than 10 minutes
  • Export the generated data to SQL

Example

If you wanted to generate 1000 random people, just define what a person looks like and dammy will handle the rest

from dammy import EntityGenerator
from dammy.functions import cast
from dammy.stdlib import RandomName, RandomString, RandomDateTime, RandomInteger, CountryName

class Person(EntityGenerator):
    first_name = RandomName().upper()
    password = RandomString(5)
    birthday = RandomDateTime(start=datetime(1980, 1, 1), end=datetime(2000, 12, 31), date_format='%d/%m/%Y')
    favorite_number = RandomInteger(0, 10)
    age = cast((datetime.now() - birthday).days / 365.25, int)
    country = CountryName()

# Generate 1000 random people
for i in range(0, 1000):
    print(Person())

It also supports relationships between tables, so you can generate data to populate databases

from dammy import EntityGenerator
from dammy.db import AutoIncrement, PrimaryKey, ForeignKey
from dammy.stdlib import RandomName, RandomString, RandomDateTime, RandomInteger, CountryName

# Define what a person looks like
class Person(EntityGenerator):
    identifier = PrimaryKey(AutoIncrement())
    first_name = RandomName().upper()
    password = RandomString(5)
    birthday = RandomDateTime(start=datetime(1980, 1, 1), end=datetime(2000, 12, 31), date_format='%d/%m/%Y')
    favorite_number = RandomInteger(0, 10)
    age = cast((datetime.now() - birthday).days / 365.25, int)
    country = CountryName()

# Define what a car looks like
class Car(EntityGenerator):
    identifier = PrimaryKey(AutoIncrement())
    manufacturer_name = CarBrand())
    model = CarModel(car_brand=manufacturer_name)
    owner = ForeignKey(Person, 'identifier')

And the data can be exported to SQL

from dammy import DatasetGenerator

# Generate a dataset with 20000 cars and 94234 people
dataset = DatasetGenerator((Car, 20000), (Person, 94234))
dataset.get_sql(save_to='cars_with_owners.sql')

Installation

To install the latest stable release of dammy using pip

pip install dammy

You can also install the latest development release by cloning the and installing it with pip

git clone https://github.com/ibonn/dammy.git dammy
cd dammy
pip install -e .

Release history

  • 0.1.3

    • Code refactored
    • All binary operations made possible between BaseGenerator objects
    • BaseDammy renamed to BaseGenerator
    • EntityGenerator renamed to OperationResult
    • DammyEntity renamed to EntityGenerator
    • Everything inherits from BaseGenerator
    • Removed DatabaseConstraint
    • Added UNIQUE constraint support
    • Datasets can now be exported to JSON
    • Entities can now be exported to JSON and CSV
    • dammy.stdlib expanded with new built-in generators
  • 0.1.2

    • Documentation improved
    • DatasetGenerator moved from main to db
    • Minor bugs fixed
  • 0.1.1

    • Can get attributes of entities
    • Can call methods on entities
    • Ability to perform operations added
    • Code improved
    • Docstrings added
  • 0.0.3

    • Fixed import bug in stdlib
  • 0.0.1

    • First release

Metadata

Release files for dammy 0.1.3

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

Source distribution (sdist)

Source distribution for dammy 0.1.3
File Size Uploaded Provenance Actions
dammy-0.1.3.tar.gz 15.0 kB Without provenance Details for dammy-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dammy 0.1.3
File Interpreter ABI Platform Actions
dammy-0.1.3-py3-none-any.whl Python 3 none any Details for dammy-0.1.3-py3-none-any.whl

Total release size: 51.6 kB

Release files / dammy-0.1.3.tar.gz

Download URL dammy-0.1.3.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
89f6c636e2d46fbcf3c04bc80f7a14d3125eeea5e299341ea06caa6d2b13788f
BLAKE2b-256 checksum
How to use checksums
d5e4ea136a694611d08ee33e531413d42cf07b8f0d0b2b8d8a11d5a02ea2b7bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / dammy-0.1.3-py3-none-any.whl

Download URL dammy-0.1.3-py3-none-any.whl
Size 36.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2628aec8169169525bb82bc952066142e8853349653ee1e710ba44cd368ccac4
BLAKE2b-256 checksum
How to use checksums
c876076e6a0d74f7a9c776719eeca907b1db369a2071248c3ef578d46a416022
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Security for dammy 0.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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