{ "info": { "author": "Lele Gaifax", "author_email": "lele@metapensiero.it", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Database" ], "description": ".. -*- coding: utf-8 -*-\n.. :Progetto: arstecnica.sqlalchemy.async -- Asyncio middleware for SA\n.. :Creato: ven 10 lug 2015 10:48:44 CEST\n.. :Autore: Lele Gaifax \n.. :Licenza: GNU General Public License version 3 or later\n..\n\n=============================\n arstecnica.sqlalchemy.async\n=============================\n\nA port of Alchimia_ to Python 3.4 asyncio\n=========================================\n\nThe aiopg_ and aiomysql_ projects allow to operate asynchronously with\nPostgresQL_ and MySQL_, respectively, even thru SQLAlchemy_. Their\napproach isn't ideal, though, because they reimplement a considerable\namount of SA low level stuff with undesirable glitches.\n\nThe Twisted_ based Alchimia_ way is much lighter and even if maybe\nslightly less performant it does not introduce unexpected surprises.\n\nUsage\n-----\n\nBasically the module wraps a minimal set of SA classes (currently just\n``Engine``, ``Connection``, ``Transaction`` and ``ResultProxy``) into\nasyncronous counterparts, and you work on them like the following\nexample::\n\n from asyncio import coroutine\n from arstecnica.sqlalchemy.async import create_engine\n\n @coroutine\n def do_something(db_url):\n engine = create_engine(db_url)\n with (yield from engine.connect()) as conn:\n with (yield from conn.begin()) as trans:\n yield from conn.execute(users.insert()\n .values(id=42, name=\"Async\",))\n\n res = yield from conn.execute(users.select()\n .where(users.c.id == 42))\n rows = yield from res.fetchall()\n\n res = yield from conn.execute(users.delete()\n .where(users.c.id == 42))\n assert res.rowcount == 1\n\nIf you are using Python 3.5 or better, the above should be written as::\n\n from arstecnica.sqlalchemy.async import create_engine\n\n async def do_something(db_url):\n engine = create_engine(db_url)\n async with await engine.connect() as conn:\n async with await conn.begin() as trans:\n await conn.execute(users.insert()\n .values(id=42, name=\"Async\",))\n\n res = await conn.execute(users.select()\n .where(users.c.id == 42))\n rows = await res.fetchall()\n\n res = await conn.execute(users.delete()\n .where(users.c.id == 42))\n assert res.rowcount == 1\n\nTests\n-----\n\nTo run the unit tests, you should:\n\na) create a Python virtual environment and install this package in\n development mode::\n\n python3 -m venv env\n source env/bin/activate\n python setup.py develop\n\nb) install ``pytest`` and either ``psycopg2`` or ``pymysql``::\n\n pip install pytest psycopg2 pymysql\n\nc) create a test database, for example with ``createdb testdb``\n\nd) execute the ``py.test`` runner with an environment variable with\n the SA URL of the db::\n\n TEST_DB_URL=\"postgresql://localhost/testdb\" py.test src\n TEST_DB_URL=\"mysql+pymysql://localhost/testdb\" py.test src\n\n.. _aiomysql: https://github.com/aio-libs/aiomysql\n.. _aiopg: https://github.com/aio-libs/aiopg\n.. _alchimia: https://pypi.python.org/pypi/alchimia\n.. _mysql: http://www.mysql.com\n.. _postgresql: http://www.postgresql.org\n.. _sqlalchemy: http://www.sqlalchemy.org\n.. _twisted: https://twistedmatrix.com/\n\n\nChanges\n-------\n\n0.4 (2015-09-25)\n~~~~~~~~~~~~~~~~\n\n- Packaging tweaks\n\n\n0.3 (2015-09-23)\n~~~~~~~~~~~~~~~~\n\n- Support Python 3.5 asynchronous context managers\n\n\n0.2 (2015-09-09)\n~~~~~~~~~~~~~~~~\n\n- First (usable) distribution on PyPI\n\n\n0.1 (private)\n~~~~~~~~~~~~~\n\nWorks reasonably well!\n\n\n0.0 (private)\n~~~~~~~~~~~~~\n\nInitial effort.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/arstecnica/arstecnica.sqlalchemy.async", "keywords": "asyncio sqlalchemy", "license": "GPLv3+", "maintainer": null, "maintainer_email": null, "name": "arstecnica.sqlalchemy.async", "package_url": "https://pypi.org/project/arstecnica.sqlalchemy.async/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/arstecnica.sqlalchemy.async/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://gitlab.com/arstecnica/arstecnica.sqlalchemy.async" }, "release_url": "https://pypi.org/project/arstecnica.sqlalchemy.async/0.4/", "requires_dist": null, "requires_python": null, "summary": "Asyncio middleware for SQLAlchemy", "version": "0.4" }, "last_serial": 1738711, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "ea0923ab11533ef0e69d571f1613abfa", "sha256": "cd2d8088a531d62f0d446d71e2f3f4d8aff3c43739c6312b749db03e1c813a69" }, "downloads": -1, "filename": "arstecnica.sqlalchemy.async-0.1.tar.gz", "has_sig": false, "md5_digest": "ea0923ab11533ef0e69d571f1613abfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4847, "upload_time": "2015-09-09T14:22:07", "url": "https://files.pythonhosted.org/packages/b9/4e/9ceae4f1bbe4846b2f19e6cb2b48738e6df9c55a1237d97d77ca30513af3/arstecnica.sqlalchemy.async-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "6051b1215ce096169e82ed740413f981", "sha256": "96db9e41dea9528a831e0d0a5f1058a920d80955258879f5ceeeb1f25f330522" }, "downloads": -1, "filename": "arstecnica.sqlalchemy.async-0.2.tar.gz", "has_sig": false, "md5_digest": "6051b1215ce096169e82ed740413f981", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5963, "upload_time": "2015-09-09T15:01:25", "url": "https://files.pythonhosted.org/packages/cb/49/e0403d5ef202de1864e402a9e19b3f44520c6c917c614986b0e2aefbae9b/arstecnica.sqlalchemy.async-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "c47bd27c8743d1ac91aed951977a4db2", "sha256": "8ed4bd621116c7d5db6eb5570d34c27fc7169f0eff3c72c4e50bc13405e4bcda" }, "downloads": -1, "filename": "arstecnica.sqlalchemy.async-0.3.tar.gz", "has_sig": false, "md5_digest": "c47bd27c8743d1ac91aed951977a4db2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6353, "upload_time": "2015-09-23T06:26:52", "url": "https://files.pythonhosted.org/packages/3c/ff/c3a883ccc65dba39b76e98cb1b1b9618f3461a70a0449d77925522eec793/arstecnica.sqlalchemy.async-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "0c2373b54281f81adb7cdd083501dead", "sha256": "2a901c6f8b59e2b6fb5598c2b8fe03d8e58251593525c1f9d71ea7a42613940c" }, "downloads": -1, "filename": "arstecnica.sqlalchemy.async-0.4.tar.gz", "has_sig": false, "md5_digest": "0c2373b54281f81adb7cdd083501dead", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6316, "upload_time": "2015-09-25T16:55:49", "url": "https://files.pythonhosted.org/packages/36/08/818dbe419bf27ccc3eddf27ee9d7944e977a2f82d5c8fad48a1c5ba9b648/arstecnica.sqlalchemy.async-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0c2373b54281f81adb7cdd083501dead", "sha256": "2a901c6f8b59e2b6fb5598c2b8fe03d8e58251593525c1f9d71ea7a42613940c" }, "downloads": -1, "filename": "arstecnica.sqlalchemy.async-0.4.tar.gz", "has_sig": false, "md5_digest": "0c2373b54281f81adb7cdd083501dead", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6316, "upload_time": "2015-09-25T16:55:49", "url": "https://files.pythonhosted.org/packages/36/08/818dbe419bf27ccc3eddf27ee9d7944e977a2f82d5c8fad48a1c5ba9b648/arstecnica.sqlalchemy.async-0.4.tar.gz" } ] }