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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for gino_factory-0.1.0a7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1971aba8d150b0fb6d6e989b2807ed04c68add85f2a5cac4b6a080882780d82 |
|
MD5 | 0a54d9bab4483adbbd4f9923b337edc7 |
|
BLAKE2b-256 | 20f64f372021f95795aa5352e8d78572735beed2596f99d389adcbcd986200ff |