{"id":20400853,"url":"https://github.com/vinissimus/asyncom","last_synced_at":"2025-04-12T14:08:52.264Z","repository":{"id":34540750,"uuid":"180125206","full_name":"vinissimus/asyncom","owner":"vinissimus","description":"Async python OM","archived":false,"fork":false,"pushed_at":"2022-12-26T20:47:15.000Z","size":46,"stargazers_count":35,"open_issues_count":6,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T08:47:34.346Z","etag":null,"topics":["aio","asyncio","sqlalchemy"],"latest_commit_sha":null,"homepage":null,"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/vinissimus.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-08T10:26:07.000Z","updated_at":"2022-12-10T00:14:02.000Z","dependencies_parsed_at":"2023-01-15T07:39:34.331Z","dependency_job_id":null,"html_url":"https://github.com/vinissimus/asyncom","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasyncom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasyncom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasyncom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasyncom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinissimus","download_url":"https://codeload.github.com/vinissimus/asyncom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578869,"owners_count":21127713,"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":["aio","asyncio","sqlalchemy"],"created_at":"2024-11-15T04:46:58.459Z","updated_at":"2025-04-12T14:08:52.244Z","avatar_url":"https://github.com/vinissimus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# AsyncOM\n\nAsync OM it's a super basic Object mapper based almost all on sqlalchemy\nORM layer.\n\nWe use the declarative extension for building the classes, and also,\nfactor instances of them on querys. (*Limited support)\n\nThere is still no support for relations.\n\nDepens on [encode/databases](https://github.com/encode/databases) dependency.\n\n\n## Motivation\n\nI don't like the asyncpgsa approach where they are just using,\nthe core layer, to build run the sqlgenerator. I like to build,\naround the declarative layer of sqlachemy, and later found that\nI can patch some of the methods on the session.query, to\nuse it's own sql generator, and turn async the query system.\n\nObject persistent is minimal, and needs some love.\n\n\n## Usage\n\n```python\n\nfrom sqlalchemy.ext.declarative import declarative_base\nimport sqlalchemy as sa\nfrom databases import DatabaseURL\n\nBase = declarative_base()\n\n\nclass OrmTest(Base):\n    __tablename__ = 'orm_test'\n\n    id = sa.Column(sa.Integer, primary_key=True)\n    name = sa.Column(sa.String(100), index=True)\n    value = sa.Column(sa.Text)\n\n# Instead of usign Database from databases, you can use:\ndb = OMDatabase(DatabaseURL('postgres://root@postgres:{port}/guillotina'))\n\n# instances of the object can be created with:\ntest = OrmTest(name='xx', value='yy')\nawait db.add(test)\n\nprint(test.id)  # pk column is correct set\n\n# get an instance\nins = await db.query(OrmTest).get(1)\n\ntotal = await db.query(OrmTest).count()\nassert total == 1\n\n# remove it\nawait db.delete(ins)\n\n# filter them\nres = await db.query(OrmTest).filter(\n    OrmTest.name.like('xx')).all()\n\n# Or just iterate over the results with a cursor:\nasync for row in db.query(OrmTest).filter(OrmTest.name.like('xx')):\n    print(f'Row {row.name}: {row.value}')\n\n\n# There is basic support for table inheritance query OneToOne\n\n\n# Look at tests\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinissimus%2Fasyncom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinissimus%2Fasyncom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinissimus%2Fasyncom/lists"}