Masonite Fixtures
The masonite-fixtures package provides utilities for managing fixture data in python applications. It offers a convenient way to populate database tables with predefined data.
Installation
You can install masonite-fixtures via pip:
pip install masonite-fixtures
Features
- Initialize fixture data for database tables effortlessly.
- Automatically create database tables based on the schema of the fixture model.
- Populate database tables with data defined in the fixture model using either
get_rowsmethod orrowsproperty. - Enable query logging for debugging and monitoring database interactions.
Usage
To use the masonite-fixtures package, follow these steps:
- Import your model class that implements the
FixtureMixin. - Mix the
FixtureMixininto your model class.
That's it.
3. Optionally, set the __log_queries__ attribute to True to enable query logging.
Example:
from typing import Any
from masoniteorm.models import Model
from masonite_fixtures import FixtureMixin
# Example using get_rows method:
class User(Model, FixtureMixin):
def get_rows(self) -> list[dict[str, Any]]:
return [
{"name": "John", "age": 30},
{"name": "Alice", "age": 25},
# Add more rows as needed
]
# Example using rows attribute:
class User(Model, FixtureMixin):
rows: list[dict[str, Any]] = [
{"name": "John", "age": 30},
{"name": "Alice", "age": 25},
# Add more rows as needed
]
Thats it. You can now use the model as you would any other masoniteorm model.
Important
If the number of rows defined in the rows attribute or get_rows property of the fixture model class exceeds the number of rows stored in the actual database cache for the fixture, the fixture will reset the database table and reseed the fixture data.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for masonite-fixtures 0.0.5
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 |
|---|---|---|---|---|
| masonite-fixtures-0.0.5.tar.gz | 3.6 kB | Without provenance | Details for masonite-fixtures-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| masonite_fixtures-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for masonite_fixtures-0.0.5-py3-none-any.whl |
Total release size: 7.6 kB
Release files / masonite-fixtures-0.0.5.tar.gz
| Download URL | masonite-fixtures-0.0.5.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc8aa832f4fe304f873fe79693e4b77cb57ae3afd15c2b21da1233dc6c493dbb
|
|
BLAKE2b-256 checksum How to use checksums |
360033c653bd2fafc0ced7f0e21773468fe3c72a741b58ea9152651a5179aad5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.4
|
Release files / masonite_fixtures-0.0.5-py3-none-any.whl
| Download URL | masonite_fixtures-0.0.5-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ff11d843c13a2652f91080b11eac93ae00159ad6852f9f415478f3dd201c75d
|
|
BLAKE2b-256 checksum How to use checksums |
901c2e10bcf2e4de872d278d65cac672c9e52a28fa8d74c570b1bf08dce96ea0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.4
|
Security for masonite-fixtures 0.0.5
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.