Conntext-0.1.5
توضیحات
Context managers for secure and atomic database connectivity
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | Conntext-0.1.5 |
| نام | Conntext |
| نسخه کتابخانه | 0.1.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | James Nah |
| ایمیل نویسنده | sangho.nah@gmail.com |
| آدرس صفحه اصلی | https://github.com/microamp/conntext |
| آدرس اینترنتی | https://pypi.org/project/Conntext/ |
| مجوز | GNU Lesser General Public License v3 or later (LGPLv3+) |
Conntext
========
Context managers for secure and atomic database connectivity
Rationale
---------
- Each context being a single atomic process ("either all occur, or nothing occurs")
- No manual ``commit`` (success), ``rollback`` (fail) or ``close`` (either)
- No ORM
Usage
-----
Without Conntext,
.. code-block:: python
conn = sqlite3.connect(":memory:")
try:
cursor = conn.cursor()
try:
cursor.execute("CREATE TABLE person (name)")
cursor.execute("INSERT INTO person (name) VALUES (?)",
["microamp"])
except Exception:
raise
finally:
cursor.close()
except Exception:
conn.rollback()
raise
else:
conn.commit()
finally:
conn.close()
With Conntext,
.. code-block:: python
from conntext import conntext
with conntext.conn(sqlite3.connect(":memory:")) as conn:
with conntext.cursor(conn.cursor()) as cursor:
cursor.execute("CREATE TABLE person (name)")
cursor.execute("INSERT INTO person (name) VALUES (?)",
["microamp"])
License
-------
All the code is licensed under the GNU Lesser General Public License (v3+).
نحوه نصب
نصب پکیج whl Conntext-0.1.5:
pip install Conntext-0.1.5.whl
نصب پکیج tar.gz Conntext-0.1.5:
pip install Conntext-0.1.5.tar.gz