SQLAlchemy Faker is a provider for the Faker library that helps populate ORM models with dummy data. Creating a new instance of a model can be as simple as calling fake.sqlalchemy_model(SomeModel).
Installation
The recommend way to install SQLAlchemy Faker is with pip:
pip install faker_sqlalchemy
Example
Say you have some model declared using SQLAlchemy’s ORM.
>>> class SomeModel(Base): ... __tablename__ = "some_model" ... ... id = Column(Integer, primary_key=True) ... ... value = Column(String)
And, you want to easily generate some data,
>>> from faker_sqlalchemy import SqlAlchemyProvider >>> >>> fake = Faker() >>> fake.add_provider(SqlAlchemyProvider) >>> >>> instance = fake.sqlalchemy_model(SomeModel)
Use instance as desired.
>>> print(instance.value) RNvnAvOpyEVAoNGnVZQU
Release files for faker_sqlalchemy 0.9.220807.post1550
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| faker_sqlalchemy-0.9.220807.post1550.tar.gz | 9.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| faker_sqlalchemy-0.9.220807.post1550-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / faker_sqlalchemy-0.9.220807.post1550.tar.gz
| Download URL | faker_sqlalchemy-0.9.220807.post1550.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcad951e88c6c62d596691e8ed2ddd5ca27d4454e5181a514e31eeeb5927fd75
|
|
BLAKE2b-256 checksum How to use checksums |
c4372309fa872c8ea7ea5821ea7a343860bdcefbf0873e7b862bf898ef8b2050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / faker_sqlalchemy-0.9.220807.post1550-py3-none-any.whl
| Download URL | faker_sqlalchemy-0.9.220807.post1550-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
723ced898f6b87d70c898841483837a68afdfc13c838e0faac10609a585187cf
|
|
BLAKE2b-256 checksum How to use checksums |
e0f2a9f46a2a07d80e9003ca14e035904608556e2e660f990b116b3fff7dfccd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|