Alchemytools-0.7.0


توضیحات

Alchemytools is a set of helpers to be used in any SQLAlchemy project
ویژگی مقدار
سیستم عامل -
نام فایل Alchemytools-0.7.0
نام Alchemytools
نسخه کتابخانه 0.7.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Dalton Barreto
ایمیل نویسنده daltonmatos@gmail.com
آدرس صفحه اصلی https://github.com/daltonmatos/alchemytools
آدرس اینترنتی https://pypi.org/project/Alchemytools/
مجوز -
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. .. code-block:: python 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. .. code-block:: python @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 ^^^^^^^^^^^^^^^ .. code-block:: shell $ python setup.py test


نحوه نصب


نصب پکیج whl Alchemytools-0.7.0:

    pip install Alchemytools-0.7.0.whl


نصب پکیج tar.gz Alchemytools-0.7.0:

    pip install Alchemytools-0.7.0.tar.gz