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 details)
Built Distribution
File details
Details for the file gino-factory-0.1.0a7.tar.gz
.
File metadata
- Download URL: gino-factory-0.1.0a7.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 561dd94e9683381f6a9dfb62f7aec7b86151e6e32c62090e8977b72e1ed7c22b |
|
MD5 | c04f3867cfa1aeda91e4d2c93cb8d502 |
|
BLAKE2b-256 | 8883375530d8e446dd1de2b0c233e2ce085f208fa1623c4bb1d36d70921c76b8 |
File details
Details for the file gino_factory-0.1.0a7-py3-none-any.whl
.
File metadata
- Download URL: gino_factory-0.1.0a7-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1971aba8d150b0fb6d6e989b2807ed04c68add85f2a5cac4b6a080882780d82 |
|
MD5 | 0a54d9bab4483adbbd4f9923b337edc7 |
|
BLAKE2b-256 | 20f64f372021f95795aa5352e8d78572735beed2596f99d389adcbcd986200ff |