{"id":27904781,"url":"https://github.com/couchbase/columnar-python-client","last_synced_at":"2025-05-05T23:15:05.056Z","repository":{"id":254514121,"uuid":"827053031","full_name":"couchbase/columnar-python-client","owner":"couchbase","description":"Couchbase Python Columnar Client Library","archived":false,"fork":false,"pushed_at":"2024-10-17T16:13:57.000Z","size":362,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-05-05T23:14:59.634Z","etag":null,"topics":[],"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/couchbase.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":"2024-07-10T23:42:44.000Z","updated_at":"2025-04-01T20:58:09.000Z","dependencies_parsed_at":"2024-08-24T00:44:20.183Z","dependency_job_id":"fa1231a0-2c3f-4b7e-b5a6-ac36dc5ef1eb","html_url":"https://github.com/couchbase/columnar-python-client","commit_stats":null,"previous_names":["couchbaselabs/columnar-python-client","couchbase/columnar-python-client"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcolumnar-python-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcolumnar-python-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcolumnar-python-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcolumnar-python-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/couchbase","download_url":"https://codeload.github.com/couchbase/columnar-python-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590633,"owners_count":21772940,"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":[],"created_at":"2025-05-05T23:15:04.561Z","updated_at":"2025-05-05T23:15:05.039Z","avatar_url":"https://github.com/couchbase.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Couchbase Python Columnar Client\nPython client for [Couchbase](https://couchbase.com) Columnar\n\nCurrently Python 3.8 - Python 3.12 is supported.\n\nThe Columnar SDK supports static typing.  Currently only [mypy](https://github.com/python/mypy) is supported.  You mileage may vary (YMMV) with the use of other static type checkers (e.g. [pyright](https://github.com/microsoft/pyright)).\n\n# Installing the SDK\u003ca id=\"installing-the-sdk\"\u003e\u003c/a\u003e\n\nWheels are provided for linux, MacOS and Windows environments for supported Python versions (currently Python 3.8 - Python 3.12).\n\n\u003eNote: It is strongly recommended to update pip, setuptools and wheel prior to installing the SDK: `python3 -m pip install --upgrade pip setuptools wheel`\n\nInstall the SDK via `pip`:\n```console\npython3 -m pip install couchbase-columnar\n```\n\n# Installing the SDK from source\n\nIf a compatible wheel is not available, the SDK's binary will need to be built from source:\n\n1. Follow the steps on the [BUILDING page](https://github.com/couchbaselabs/columnar-python-client/blob/main/BUILDING.md)\n2. After the build succeeds, the SDK can be used by running Python scripts from within the cloned repository or the SDK can be installed via pip: `python3 -m pip install \u003cpath to cloned repository\u003e`\n4. Install the `typing-extensions` dependency: `python3 -m pip install typing-extensions`\n\n\n# Using the SDK\u003ca id=\"using-the-sdk\"\u003e\u003c/a\u003e\n\nSome more examples are provided in the [examples directory](https://github.com/couchbaselabs/columnar-python-client/tree/main/examples).\n\n**Connecting and executing a query**\n```python\nfrom couchbase_columnar.cluster import Cluster\nfrom couchbase_columnar.credential import Credential\nfrom couchbase_columnar.options import QueryOptions\n\n\ndef main() -\u003e None:\n    # Update this to your cluster\n    connstr = 'couchbases://--your-instance--'\n    username = 'username'\n    pw = 'Password!123'\n    # User Input ends here.\n\n    cred = Credential.from_username_and_password(username, pw)\n    cluster = Cluster.create_instance(connstr, cred)\n\n    # Execute a query and buffer all result rows in client memory.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline LIMIT 10;'\n    res = cluster.execute_query(statement)\n    all_rows = res.get_all_rows()\n    for row in all_rows:\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\n    # Execute a query and process rows as they arrive from server.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=\"United States\" LIMIT 10;'\n    res = cluster.execute_query(statement)\n    for row in res.rows():\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\n    # Execute a streaming query with positional arguments.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$1 LIMIT $2;'\n    res = cluster.execute_query(statement, QueryOptions(positional_parameters=['United States', 10]))\n    for row in res:\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\n    # Execute a streaming query with named arguments.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$country LIMIT $limit;'\n    res = cluster.execute_query(statement, QueryOptions(named_parameters={'country': 'United States',\n                                                                          'limit': 10}))\n    for row in res.rows():\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\n\nif __name__ == '__main__':\n    main()\n\n```\n\n## Using the async API\n```python\nfrom acouchbase_columnar import get_event_loop\nfrom acouchbase_columnar.cluster import AsyncCluster\nfrom couchbase_columnar.credential import Credential\nfrom couchbase_columnar.options import QueryOptions\n\n\nasync def main() -\u003e None:\n    # Update this to your cluster\n    connstr = 'couchbases://--your-instance--'\n    username = 'username'\n    pw = 'Password!123'\n    # User Input ends here.\n\n    cred = Credential.from_username_and_password(username, pw)\n    cluster = AsyncCluster.create_instance(connstr, cred)\n\n    # Execute a query and buffer all result rows in client memory.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline LIMIT 10;'\n    res = await cluster.execute_query(statement)\n    all_rows = await res.get_all_rows()\n    # NOTE: all_rows is a list, _do not_ use `async for`\n    for row in all_rows:\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\n    # Execute a query and process rows as they arrive from server.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=\"United States\" LIMIT 10;'\n    res = await cluster.execute_query(statement)\n    async for row in res.rows():\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\n    # Execute a streaming query with positional arguments.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$1 LIMIT $2;'\n    res = await cluster.execute_query(statement, QueryOptions(positional_parameters=['United States', 10]))\n    async for row in res:\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\n    # Execute a streaming query with named arguments.\n    statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$country LIMIT $limit;'\n    res = await cluster.execute_query(statement, QueryOptions(named_parameters={'country': 'United States',\n                                                                                'limit': 10}))\n    async for row in res.rows():\n        print(f'Found row: {row}')\n    print(f'metadata={res.metadata()}')\n\nif __name__ == '__main__':\n    loop = get_event_loop()\n    loop.run_until_complete(main())\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Fcolumnar-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouchbase%2Fcolumnar-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Fcolumnar-python-client/lists"}