SQLAlchemy Faker is a provider for the Faker library that helps populate SQLAlchemy 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
Supported Versions
Currently SQLAlchemy versions 1.3 and 1.4 are supported. Support for SQLAlchemy 2.0 will be added when it is released.
Faker versions >=8 are currently supported, though it should be noted that the testing matrix isn’t exhaustive. If bugs come up with a particular version of faker beyond version 8.0, submit a ticket to add support.
Python versions >=3.7 are currently supported. If python 3.6 support is desired, submit a ticket to add support. Support for Python 3.11 will be added when it is officially supported by SQLAlchemy. Currently, this is waiting on greenlet releasing support for python 3.11.
Release files for faker_sqlalchemy 0.10.2208140
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.10.2208140.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| faker_sqlalchemy-0.10.2208140-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.0 kB
Release files / faker_sqlalchemy-0.10.2208140.tar.gz
| Download URL | faker_sqlalchemy-0.10.2208140.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39af1d77f83f71753b4cccd16c2404ddaba9300b699f36794609ffde85c0c176
|
|
BLAKE2b-256 checksum How to use checksums |
80ec37b89e92ceda518fbbda094c3403df6fd4ebdd11dadaf5d4e0ef29372062
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / faker_sqlalchemy-0.10.2208140-py3-none-any.whl
| Download URL | faker_sqlalchemy-0.10.2208140-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e00adda7bbdda38cd6a8406a8cb8b3e905bdf3b7ab5dd7891fe1ad3f762cfb4c
|
|
BLAKE2b-256 checksum How to use checksums |
1ec6fbc5522ccbf8d287e6bbb5ba286ec4cb855f72c85d984605ca6f1a85bda6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|