Skip to main content

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

dammy

Populate your database with dummy data

Table of contents

Introduction

With dammy you can populate your database with a few lines of code.

Features

  • A set of prebuilt objects (Person names, country names, car manufacturers and models, random dates...)
  • The possibility to expand the previous library
  • Generate datasets and export them 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 DammyEntity
from dammy.stdlib import RandomName, RandomString, RandomDateTime, RandomInteger, CountryName

class Person(DammyEntity):
    first_name = RandomName()
    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 = datetime.now() - birthday
    country = CountryName()

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

It also supports relationships between tables

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

# Define what a person looks like
class Person(DammyEntity):
    identifier = PrimaryKey(AutoIncrement())
    first_name = RandomName()
    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 = datetime.now() - birthday
    country = CountryName()

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

And 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 release of dammy pip run

pip install dammy

Release history

  • 0.0.3
    • Fixed import bug in stdlib
  • 0.0.1
    • First release

Metadata

Release files for dammy 0.0.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.0.3
File Size Uploaded Provenance Actions
dammy-0.0.3.tar.gz 6.6 kB Without provenance Details for dammy-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 23.7 kB

Release files / dammy-0.0.3.tar.gz

Download URL dammy-0.0.3.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0607080464408ee1d53f20b1e0fae0b813ae0da837a5b930c00252affece4fa2
BLAKE2b-256 checksum
How to use checksums
3b575b60fdeea1c16701539d1ec1d6a5dbbdd826dad304f8ab1681aa7c6de1f1
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.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.5

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

Download URL dammy-0.0.3-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9108ea9d7a566c37b31f4c1e35bf0e09536e3f5f5da04eab204c0f4b6f35fc7
BLAKE2b-256 checksum
How to use checksums
7266fa9585af8cf0f73f82b8f201513697aa67559eb212f919d60db68c2a7c70
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.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.5

Security for dammy 0.0.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