Skip to main content

Gino Factory

Project description

Install: pip install gino-factory

Github: https://github.com/Basalex/gino_factory

Examples of usage:

Let’s create gino model

class User(db.Model):
    __tablename__ = 'users'
    id = db.Column(db.BigInteger(), primary_key=True)
    parent_id = db.Column(db.BigInteger(), primary_key=True)
    username = db.Column(db.String(255), nullable=False, unique=True)
    custom_field = db.Column(db.String(255), nullable=False, unique=True)
    custom_factory = db.Column(db.String(255), nullable=False, unique=True)

Next you need to register this model

from gino_factory import GinoFactory

class Factory(GinoFactory):
    pass

Factory.register(User, custom_field='value', custom_factory=function)

And use this class for testing purposes

async def test():
    user = await Factory.user()
    ten_users = await Factory.cycle(10).user()
    user_tree = await Factory.tree().user()

or you may fill your database with random data using __random__ method

await Factory.__random__()

This method inserts random data to all registered tables

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

gino-factory-0.1.0a7.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

gino_factory-0.1.0a7-py3-none-any.whl (7.0 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