marshmallow-sqlalchemy-referential
Installation
pip install marshmallow-sqlalchemy-referential
Sample Usage
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy_referential import Referential
from marshmallow_sqlalchemy import ModelSchema
from marshmallow import fields
Base = declarative_base()
user_group_assoc = sa.Table(
'user_group_assoc', Base.metadata,
sa.Column('user_id', sa.Integer, sa.ForeignKey('user.id')),
sa.Column('group_id', sa.Integer, sa.ForeignKey('group.id'))
)
class User(Base):
__tablename__ = 'user'
id = sa.Column(sa.Integer(), primary_key=True)
groups = sa.orm.relationship('Group', secondary=user_group_assoc)
class Group(Base):
__tablename__ = 'group'
id = sa.Column(sa.Integer(), primary_key=True)
users = sa.orm.relationship('User', secondary=user_group_assoc)
class GroupSchema(ModelSchema):
class Meta():
dump_only = ['id']
id = fields.Integer()
class UserSchema(ModelSchema):
class Meta():
dump_only = ['id']
id = fields.Integer()
groups = Referential(GroupSchema, model=Group, many=True)
Metadata
Release files for marshmallow-sqlalchemy-referential 1.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 |
|---|---|---|---|---|
| marshmallow-sqlalchemy-referential-1.0.5.tar.gz | 3.9 kB | Without provenance | Details for marshmallow-sqlalchemy-referential-1.0.5.tar.gz |
Release files / marshmallow-sqlalchemy-referential-1.0.5.tar.gz
| Download URL | marshmallow-sqlalchemy-referential-1.0.5.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06c27feaeca029b9616a10fa4b99a351064ae6db4b6bdeb56e3ad1245b783d2f
|
|
BLAKE2b-256 checksum How to use checksums |
2f28def2862238bef90a3da78a3055fcdaa44d05b160fdf18b616962be0f64f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for marshmallow-sqlalchemy-referential 1.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.