SQLAlchemy Model Builder
Features
- Build SQLAlchemy model instance with random data
- Save SQLAlchemy model instance with random data
- Build relationships
- Build minimal (with required fields) only
Installation
$ pip install sqlalchemy-model-builder
How to use
Deinfe the SQLAlchemy models:
from sqlalchemy import Integer, String, Text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Address(Base):
__tablename__ = "addresses"
id = Column(Integer, primary_key=True)
user_id = Column(Integer, ForeignKey("users.id"))
user = relationship("User", back_populates="addresses")
class User(Base):
__tablename__ = "users"
addresses = relationship("Address", back_populates="user")
bio = Column(Text)
id = Column(Integer, primary_key=True)
name = Column(String, nullable=False)
Save random model instance:
from sqlalchemy_model_builder import ModelBuilder
random_user = ModelBuilder(User).save(db)
Build random model without saving:
random_user = ModelBuilder(User).build()
Build minimal model instance:
minimal_random_user = ModelBuilder(User, minimal=True).build()
Build or save with specific values:
random_address = ModelBuilder(Address).build(user_id=1)
Supported Data Types
- BigInteger
- Boolean
- Date
- DateTime
- Enum
- Float
- Integer
- Interval
- LargeBinary
- MatchType (Todo)
- Numeric
- PickleType (Todo)
- SchemaType (Todo)
- SmallInteger
- String
- Text
- Time
- Unicode
- UnicodeText
Metadata
Release files for sqlalchemy-model-builder 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlalchemy_model_builder-0.3.0.tar.gz | 7.1 kB | Without provenance | Details for sqlalchemy_model_builder-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlalchemy_model_builder-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for sqlalchemy_model_builder-0.3.0-py3-none-any.whl |
Total release size: 13.3 kB
Release files / sqlalchemy_model_builder-0.3.0.tar.gz
| Download URL | sqlalchemy_model_builder-0.3.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4230c18cb1c723197b363cd8af1f127a4d4e971021288653f1fd726718e9f2da
|
|
BLAKE2b-256 checksum How to use checksums |
3134cbd275403ce60394e835eac0490b252f6c0e8b33bd35480c78e19c3a9815
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.24.1
|
Release files / sqlalchemy_model_builder-0.3.0-py3-none-any.whl
| Download URL | sqlalchemy_model_builder-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b578086b97211340e18686a806cff71ab04f99c00d17db2830b248557f3170f2
|
|
BLAKE2b-256 checksum How to use checksums |
82e5bb2f0bcff60645f67f75f24a1455ed4e24c588e42288f47f3119df09cf14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.24.1
|
Security for sqlalchemy-model-builder 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.