{"id":13936451,"url":"https://github.com/siddhantgoel/tornado-sqlalchemy","last_synced_at":"2025-04-05T16:05:08.086Z","repository":{"id":57476634,"uuid":"95905937","full_name":"siddhantgoel/tornado-sqlalchemy","owner":"siddhantgoel","description":"SQLAlchemy support for Tornado","archived":false,"fork":false,"pushed_at":"2024-06-06T23:29:19.000Z","size":284,"stargazers_count":123,"open_issues_count":4,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T15:04:15.968Z","etag":null,"topics":["asynchronous","asyncio","database","orm","python","sqlalchemy","tornado","web"],"latest_commit_sha":null,"homepage":"https://tornado-sqlalchemy.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siddhantgoel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"siddhantgoel"}},"created_at":"2017-06-30T16:27:38.000Z","updated_at":"2025-01-31T07:03:57.000Z","dependencies_parsed_at":"2024-06-18T17:31:10.539Z","dependency_job_id":"3fc07140-8684-4dfe-9bcf-6243132c6dde","html_url":"https://github.com/siddhantgoel/tornado-sqlalchemy","commit_stats":{"total_commits":279,"total_committers":11,"mean_commits":"25.363636363636363","dds":0.6272401433691757,"last_synced_commit":"39ffadbf7060fd4b8380760884f4bc30ff0fb563"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Ftornado-sqlalchemy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Ftornado-sqlalchemy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Ftornado-sqlalchemy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhantgoel%2Ftornado-sqlalchemy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siddhantgoel","download_url":"https://codeload.github.com/siddhantgoel/tornado-sqlalchemy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361617,"owners_count":20926642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","asyncio","database","orm","python","sqlalchemy","tornado","web"],"created_at":"2024-08-07T23:02:41.037Z","updated_at":"2025-04-05T16:05:08.040Z","avatar_url":"https://github.com/siddhantgoel.png","language":"Python","funding_links":["https://github.com/sponsors/siddhantgoel"],"categories":["Python","Third-Party Extensions"],"sub_categories":["Databases"],"readme":"# tornado-sqlalchemy\n\n[![image](https://travis-ci.org/siddhantgoel/tornado-sqlalchemy.svg?branch=stable)](https://travis-ci.org/siddhantgoel/tornado-sqlalchemy)\n\n[![image](https://badge.fury.io/py/tornado-sqlalchemy.svg)](https://pypi.python.org/pypi/tornado-sqlalchemy)\n\n[![image](https://readthedocs.org/projects/tornado-sqlalchemy/badge/?version=latest)](https://tornado-sqlalchemy.readthedocs.io/en/latest/)\n\n[![image](https://img.shields.io/pypi/pyversions/tornado-sqlalchemy.svg)](https://pypi.python.org/pypi/tornado-sqlalchemy)\n\nPython helpers for using [SQLAlchemy] with [Tornado].\n\n## Installation\n\n```sh\n$ pip install tornado-sqlalchemy\n```\n\nIn case you prefer installing from the Github repository, please note that `main` is the\ndevelopment branch so `stable` is what you should be installing from.\n\n## Usage\n\n```python\nfrom tornado.gen import coroutine\nfrom tornado.web import Application, RequestHandler\nfrom tornado_sqlalchemy import as_future, SessionMixin, SQLAlchemy\n\nclass NativeCoroutinesRequestHandler(SessionMixin, RequestHandler):\n    async def get(self):\n        with self.make_session() as session:\n            count = await as_future(session.query(User).count)\n\n        self.write('{} users so far!'.format(count))\n\nclass GenCoroutinesRequestHandler(SessionMixin, RequestHandler):\n    @coroutine\n    def get(self):\n        with self.make_session() as session:\n            count = yield as_future(session.query(User).count)\n\n        self.write('{} users so far!'.format(count))\n\nclass SynchronousRequestHandler(SessionMixin, RequestHandler):\n    def get(self):\n        with self.make_session() as session:\n            count = session.query(User).count()\n\n        self.write('{} users so far!'.format(count))\n\nhandlers = (\n   (r'/native-coroutines', NativeCoroutinesRequestHandler),\n   (r'/gen-coroutines', GenCoroutinesRequestHandler),\n   (r'/sync', SynchronousRequestHandler),\n)\n\napp = Application(\n   handlers,\n   db=SQLAlchemy('postgres://user:password@host/database')\n)\n```\n\n## Documentation\n\nDocumentation is available at [Read The Docs].\n\n\n## Development\n\nPlease make sure you have Python 3.8+ and [Poetry] installed.\n\nSince we run tests against multiple databases (currently MySQL, PostgreSQL, and\nSQLite), we use [docker-compose] to make our lives easier.\n\n1. Git clone the repository -\n   `git clone https://github.com/siddhantgoel/tornado-sqlalchemy`\n\n2. Install the packages required for development -\n   `poetry install`\n\n3. Ensure that the MySQL and PostgreSQL services (containers) are up -\n   `docker-compose up -d`\n\n4. That should basically be it. You should now be able to run the test suite -\n   `poetry run py.test tests/`.\n\n[docker-compose]: https://docs.docker.com/compose/\n[Poetry]: https://poetry.eustace.io/\n[Read The Docs]: https://tornado-sqlalchemy.readthedocs.io/en/stable/\n[SQLAlchemy]: http://www.sqlalchemy.org/\n[tornado]: https://www.tornadoweb.org/en/stable/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhantgoel%2Ftornado-sqlalchemy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddhantgoel%2Ftornado-sqlalchemy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhantgoel%2Ftornado-sqlalchemy/lists"}