================
This package provides an extended Base class for your SQLAlchemy classes.
What this class proposes:
* the __tablename__ to create/use for the class is automatically defined by class.__name__.lower().
* it adds a property pk_id which returns the value of the primary key for the object.
* it attaches a query object to the class which is a shortcut to session.query(class).
* Function which returns all the DB entry in a HTML table
* Function to edit/add new entry as a HTML form
Example of usage::
import sqlalchemy as sa
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
)
from zope.sqlalchemy import ZopeTransactionExtension
from sqla_declarative import extended_declarative_base
session = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = extended_declarative_base(
session,
metadata=sa.MetaData('sqlite:///:memory:'))
class Test1(Base):
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.String(50))
bob = Test1(name='Bob')
session.add(bob)
# pk_id detects automatically the primary key and returns it value
bob.pk_id == 1
# Easy querying. For example:
Test1.query.one() == bob
# To see all the existing entry as HTML
Test1.view_all()
# To add/update a new entry as HTML
widget = Test1.edit_form()
widget.display()
Metadata
Release files for sqla_declarative 0.2
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 |
|---|---|---|---|---|
| sqla_declarative-0.2.tar.gz | 3.8 kB | Without provenance | Details for sqla_declarative-0.2.tar.gz |
Release files / sqla_declarative-0.2.tar.gz
| Download URL | sqla_declarative-0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b72cd2c1f1a45cc86ddcc2913fbe926f06f024a2ccb85ae002e206a34c0df3f9
|
|
BLAKE2b-256 checksum How to use checksums |
e6e5afc336f087443e21dea5e8209766a3acac21581002a129e22a237d1ed245
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sqla_declarative 0.2
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.