Alchemytools
This project brings a set of useful tools to be used in any SQLAchemly project.
The idea is to save common problems, for example: Opening/Closing sessions, commiting the sesssin only at the end of the transaction, etc.
Available Tools
Here are all tools available in alchemytools.
Context Managers
managed
This is the basic context manager and it will commit and close your session automatically, at the end of the with block.
with managed(MySessionClass) as session: # Do what you need with your session # Here the session is already closed and commited
If you raise any exception inside the with block, the session will be rolled back and the exception re-raised.
To avoid having all of the function body inside the with block, managed functions as a context manager as well.
@managed(MySessionClass)
def foo(session, *args, **kwargs):
# Do what you need with your session
pass
# call as if the session didn't exist:
foo(2, a='b')
The session is opened every time the function is called and closed whenever it returns or raises an exception. Autommit and rollback rules work as normal.
Additional options
auto_flush: Sets the autoflush option on the SQLAlchemy session, defaults fo False
Executing tests
$ python setup.py test
Metadata
Release files for Alchemytools 0.7.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 |
|---|---|---|---|---|
| Alchemytools-0.7.0.tar.gz | 3.7 kB | Without provenance | Details for Alchemytools-0.7.0.tar.gz |
Release files / Alchemytools-0.7.0.tar.gz
| Download URL | Alchemytools-0.7.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3878a60c93904062432c99f9941cf924df66f9f51def25c2100db547d47dcf7c
|
|
BLAKE2b-256 checksum How to use checksums |
ddf516f12c3a1e82536f58646f77c5e752a62069f7d0431ff0a65483e7198433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Security for Alchemytools 0.7.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.