This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Fill your database with mocked instances.

Wrap you ORM model into a ModelWrapper, specify how your fields should look like and then generate how many instances you want of each model.

Installation

  • pip install fillmydb[peewee] if you plan to use it with peewee models
  • pip install fillmydb[django] if you plan to use it with djanog models (not implemented yet)
  • pip install fillmydb[sqlalchemy] if you plan to use it with sqlalchemy models (not implemented yet)

Usage with fake-factory

Generating instances for a single model:

import faker

factory = faker.Factory.create()

wrapper = ModelWrapper(TestModel)

wrapper[TestModel].client_name = FieldSpec(factory.name)
wrapper[TestModel].description = FieldSpec(factory.text)
wrapper[TestModel].password_hash = FieldSpec(factory.binary, length=25)
wrapper[TestModel].email = FieldSpec(factory.email)
wrapper[TestModel].visits = FieldSpec(factory.pyint)

item = wrapper.generate(100)

Generating instances for multipe models:

from tests.models import User, Post, Like
import faker

factory = faker.Factory.create()

wrapper = ModelWrapper(User, Like, Post)

wrapper[User].name = FieldSpec(factory.name)
wrapper[User].username = FieldSpec(factory.user_name)
wrapper[User].description = FieldSpec(factory.text)
wrapper[User].password_hash = FieldSpec(factory.binary, length=25)
wrapper[User].email = FieldSpec(factory.email)
wrapper[User].visits = FieldSpec(factory.pyint)

wrapper[Post].title = FieldSpec(lambda _: "test", 1)
wrapper[Post].text = FieldSpec(factory.text)

# generating 10 users, 100 likes and 20 posts
wrapper.generate(10, 100, 20)

General workflow

Pseudo-code:

initial_to_order_queue()
while models_to_process():
    model = get_next_model()

    if model.has_unresolved_dependency():
        push_back_to_queue(model)

    # process model
    for _ in range(number_of_instances):
        for field in model.fields():
            # resolve_field(field)
            if field == ForeignKey:
                field = get_random_ref_model_instance()
            else:
                field = resolve_normal()
    mark_as_processed(model)
Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
fillmydb-0.1.0.win-amd64.zip (22.1 kB) Copy SHA256 Checksum SHA256 any Dumb Binary Aug 16, 2016
fillmydb-0.1.0.zip (9.6 kB) Copy SHA256 Checksum SHA256 Source Aug 14, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting