{"id":13424637,"url":"https://github.com/CanopyTax/asyncpgsa","last_synced_at":"2025-03-15T18:35:33.667Z","repository":{"id":54539262,"uuid":"63980116","full_name":"CanopyTax/asyncpgsa","owner":"CanopyTax","description":"A wrapper around asyncpg for use with sqlalchemy","archived":false,"fork":false,"pushed_at":"2024-02-17T13:41:22.000Z","size":135,"stargazers_count":416,"open_issues_count":14,"forks_count":46,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-12T06:07:43.336Z","etag":null,"topics":["asyncio","postgres","python","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CanopyTax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","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}},"created_at":"2016-07-22T20:04:02.000Z","updated_at":"2025-02-27T12:45:21.000Z","dependencies_parsed_at":"2024-05-05T03:30:41.195Z","dependency_job_id":"133fc1f3-db0d-4136-82a4-0960601fb373","html_url":"https://github.com/CanopyTax/asyncpgsa","commit_stats":{"total_commits":123,"total_committers":34,"mean_commits":"3.6176470588235294","dds":"0.39837398373983735","last_synced_commit":"b2445202a2484494d88fc5c484d5296991973d78"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CanopyTax%2Fasyncpgsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CanopyTax%2Fasyncpgsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CanopyTax%2Fasyncpgsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CanopyTax%2Fasyncpgsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CanopyTax","download_url":"https://codeload.github.com/CanopyTax/asyncpgsa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243775907,"owners_count":20346283,"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":["asyncio","postgres","python","sqlalchemy"],"created_at":"2024-07-31T00:00:57.225Z","updated_at":"2025-03-15T18:35:33.618Z","avatar_url":"https://github.com/CanopyTax.png","language":"Python","readme":"[![Documentation Status](https://readthedocs.org/projects/asyncpgsa/badge/?version=latest)](http://asyncpgsa.readthedocs.io/en/latest/?badge=latest)\n\n# asyncpgsa\nA python library wrapper around asyncpg for use with sqlalchemy\n\n## Backwards incompatibility notice\nSince this library is still in pre 1.0 world, the api might change. \nI will do my best to minimize changes, and any changes that get added, \nI will mention here. You should lock the version for production apps.\n\n1. 0.9.0 changed the dialect from psycopg2 to pypostgres. This should be\nmostly backwards compatible, but if you notice weird issues, this is why.\nYou can now plug-in your own dialect using `pg.init(..., dialect=my_dialect)`,\nor setting the dialect on the pool. See the top of the connection file \nfor an example of creating a dialect. Please let me know if the change from\npsycopg2 to pypostgres broke you. If this happens enough, \nI might make psycopg2 the default.\n\n2. 0.18.0 Removes the Record Proxy objects that would wrap asyncpg's records. Now\nasyncpgsa just returns whatever asyncpg would return. This is a HUGE backwards incompatible change\nbut most people just used record._data to get the object directly anyways. This means dot notation\nfor columns is no longer possible and you need to access columns using exact names with dictionary notation.\n\n3. 0.18.0 Removed the `insert` method. We found this method was just confusing, and useless as SqlAlchemy can do it for you by defining your table with a primary key.\n\n4. 0.27.0 Now only compatible with version 0.22.0 and greater of asyncpg.\n\n## sqlalchemy ORM\n\nCurrently this repo does not support SA ORM, only SA Core.\n\nAs we at canopy do not use the ORM, if you would like to have ORM support\nfeel free to PR it. You would need to create an \"engine\" interface, and that\nshould be it. Then you can bind your sessions to the engine.\n\n\n## sqlalchemy Core\n\nThis repo supports sqlalchemy core. Go [here](https://github.com/CanopyTax/asyncpgsa/wiki/Examples) for examples.\n\n## Docs\n\nGo [here](https://asyncpgsa.readthedocs.io/en/latest/) for docs.\n\n## Examples\nGo [here](https://github.com/CanopyTax/asyncpgsa/wiki/Examples) for examples.\n\n## install\n\n```bash\npip install asyncpgsa\n```\n**Note**: You should **not** have `asyncpg` in your requirements at all. This lib will pull down the correct version of asyncpg for you. If you have asyncpg in your requirements, you could get a version newer than this one supports.\n\n## Contributing\nTo contribute or build this locally see [contributing.md](https://github.com/CanopyTax/asyncpgsa/blob/master/contributing.md)\n\n\n## FAQ\n\n#### Does SQLAlchemy integration defeat the point of using asyncpg as a backend (performance)?\nI dont think so. `asyncpgsa` is written in a way where any query can be a string instead of an SA object, then you will get near asyncpg speeds, as no SA code is ran. \n\nHowever, when running SA queries, comparing this to `aiopg`, it still seams to work faster. Here is a very basic `timeit` test comparing the two.\nhttps://gist.github.com/nhumrich/3470f075ae1d868f663b162d01a07838\n\n```\naiopg.sa: 9.541276566000306\nasyncpsa: 6.747777451004367\n```\nSo, seems like its still faster using asyncpg, or in otherwords, this library doesnt add any overhead that is not in aiopg.sa.\n\n## Versioning\n\nThis software follows [Semantic Versioning](http://semver.org/).\n","funding_links":[],"categories":["Third-Party Extensions","Python","数据库驱动","Database Drivers"],"sub_categories":["Databases"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCanopyTax%2Fasyncpgsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCanopyTax%2Fasyncpgsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCanopyTax%2Fasyncpgsa/lists"}