rebecca.sqla
rebecca.sqla is utility to load model made on SQLAlchemy.
INSTALL
Install using pip or easy_install:
$ pip install rebecca.sqla $ easy_install rebeca.sqla
USAGE
rebecca.sql needs sqlalchemy.orm.scoped_session.
specify session object and dsn string in settings:
sqlalchemy.url = 'sqlite:///' rebecca.sqla.session = your.app.models.DBSession
rebecca.sqla has include hook:
config.include("rebecca.sqla")
this hook sets up the bind configuration of DBSession to sqlalchemy.url.
ModelLoader and SAContext
rebecca.sqla creates attribute named “sa” to request.context. context.sa is SAContext to load models from ModelLoader registered by config.add_model_loader.
here is example models:
class Person(Base):
__tablename__ = 'person'
id = Column(Integer, primary_key=True)
name = Column(Unicode(255))
and example route:
config.add_route('person', '/person/{person1_id}/{person2_id}')
register model loaders:
config.add_model_loader('person1', Person, [('person1_id', 'id')])
config.add_model_loader('person2', Person, [('person2_id', 'id')])
add_model_loader takes 3 arguments. first is attr name of SAContext, second is a model loaded from ModelLoader and last is mappings that matchdict param to model attribute.
second argument can be dotted name.
in view, context has SAContext named “sa” attribute, that has properties of registered models. ModelLoader s load model with query using matchdict parameters.
def person(context, request):
person1 = context.sa.person1
person2 = context.sa.person2
Contributors
Atsushi Odagiri, Original Author
Changelog
0.1 (2013-03-14)
first release
Metadata
Release files for rebecca.sqla 0.1
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 |
|---|---|---|---|---|
| rebecca.sqla-0.1.tar.gz | 6.4 kB | Without provenance | Details for rebecca.sqla-0.1.tar.gz |
Release files / rebecca.sqla-0.1.tar.gz
| Download URL | rebecca.sqla-0.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f3a87e2186137d43b603cbc60658e1da48f5ea86aa79220bf2bb080cd70a911
|
|
BLAKE2b-256 checksum How to use checksums |
d731d01c98a389e167283c45032212ab401adb715248f07dab6b649b754fa965
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for rebecca.sqla 0.1
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.