{"id":13671516,"url":"https://github.com/mymarilyn/aioch","last_synced_at":"2025-04-05T22:05:28.326Z","repository":{"id":43008908,"uuid":"103985447","full_name":"mymarilyn/aioch","owner":"mymarilyn","description":" aioch - is a library for accessing a ClickHouse database over native interface from the asyncio","archived":false,"fork":false,"pushed_at":"2022-03-23T15:30:31.000Z","size":15,"stargazers_count":162,"open_issues_count":11,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T21:06:34.241Z","etag":null,"topics":["asyncio","clickhouse","database","driver","native","yandex"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mymarilyn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-18T19:56:45.000Z","updated_at":"2025-03-25T01:23:22.000Z","dependencies_parsed_at":"2022-09-26T16:20:36.351Z","dependency_job_id":null,"html_url":"https://github.com/mymarilyn/aioch","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mymarilyn%2Faioch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mymarilyn%2Faioch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mymarilyn%2Faioch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mymarilyn%2Faioch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mymarilyn","download_url":"https://codeload.github.com/mymarilyn/aioch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406085,"owners_count":20933803,"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","clickhouse","database","driver","native","yandex"],"created_at":"2024-08-02T09:01:11.619Z","updated_at":"2025-04-05T22:05:28.301Z","avatar_url":"https://github.com/mymarilyn.png","language":"Python","funding_links":[],"categories":["Python","Language bindings"],"sub_categories":["Python"],"readme":"# aioch\n**aioch** is a library for accessing a ClickHouse database over native interface from the asyncio.\nIt wraps features of [clickhouse-driver](https://github.com/mymarilyn/clickhouse-driver) for asynchronous usage.\n\n[![Coverage Status](https://coveralls.io/repos/github/mymarilyn/aioch/badge.svg?branch=master)](https://coveralls.io/github/mymarilyn/aioch?branch=master)\n[![Build Status](https://travis-ci.org/mymarilyn/aioch.svg?branch=master)](https://travis-ci.org/mymarilyn/aioch)\n\n\n## Installation\n\nThe package can be installed using `pip`:\n\n```bash\npip install aioch\n```\n\nTo install from source:\n\n```bash\ngit clone https://github.com/mymarilyn/aioch\ncd aioch\npython setup.py install\n```\n\n## Usage\n```python\nfrom datetime import datetime\n\nimport asyncio\nfrom aioch import Client\n\n\nasync def exec_progress():\n    client = Client('localhost')\n\n    progress = await client.execute_with_progress('LONG AND COMPLICATED QUERY')\n    timeout = 20\n    started_at = datetime.now()\n\n    async for num_rows, total_rows in progress:\n        done = num_rows / total_rows if total_rows else total_rows\n        now = datetime.now()\n        # Cancel query if it takes more than 20 seconds to process 50% of rows.\n        if (now - started_at).total_seconds() \u003e timeout and done \u003c 0.5:\n            await client.cancel()\n            break\n    else:\n        rv = await progress.get_result()\n        print(rv)\n\n\nasync def exec_no_progress():\n    client = Client('localhost')\n    rv = await client.execute('LONG AND COMPLICATED QUERY')\n    print(rv)\n\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(asyncio.wait([exec_progress(), exec_no_progress()]))\n```\n\nFor more information see **clickhouse-driver** usage examples.\n\n## Parameters\n\n* `executor` - instance of custom Executor, if not supplied default executor will be used\n* `loop` - asyncio compatible event loop\n\nOther parameters are passing to wrapped clickhouse-driver's Client.\n\n## License\n\naioch is distributed under the [MIT license](http://www.opensource.org/licenses/mit-license.php).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmymarilyn%2Faioch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmymarilyn%2Faioch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmymarilyn%2Faioch/lists"}