# YDB Python DBAPI
## Introduction
Python DBAPI to `YDB`, which provides both sync and async drivers and complies with [PEP249](https://www.python.org/dev/peps/pep-0249/).
## Installation
```shell
pip install ydb-dbapi
```
## Usage
To establish a new DBAPI connection you should provide `host`, `port` and `database`:
```python
import ydb_dbapi
connection = ydb_dbapi.connect(
host="localhost", port="2136", database="/local"
) # sync connection
async_connection = await ydb_dbapi.async_connect(
host="localhost", port="2136", database="/local"
) # async connection
```
Usage of connection:
```python
with connection.cursor() as cursor:
cursor.execute("SELECT id, val FROM table")
row = cursor.fetchone()
rows = cursor.fetchmany(size=5)
rows = cursor.fetchall()
```
Usage of async connection:
```python
async with async_connection.cursor() as cursor:
await cursor.execute("SELECT id, val FROM table")
row = await cursor.fetchone()
rows = await cursor.fetchmany(size=5)
rows = await cursor.fetchall()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ydb-platform/ydb-python-dbapi/",
"name": "ydb-dbapi",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Yandex LLC",
"author_email": "ydb@yandex-team.ru",
"download_url": "https://files.pythonhosted.org/packages/b0/5e/501d369435e2d3b694a6b3138bfa639bd39653dc8281ffa276ccc436355c/ydb_dbapi-0.1.6.tar.gz",
"platform": null,
"description": "# YDB Python DBAPI\n\n## Introduction\n\nPython DBAPI to `YDB`, which provides both sync and async drivers and complies with [PEP249](https://www.python.org/dev/peps/pep-0249/).\n\n## Installation\n\n```shell\npip install ydb-dbapi\n```\n\n## Usage\n\nTo establish a new DBAPI connection you should provide `host`, `port` and `database`:\n\n```python\nimport ydb_dbapi\n\nconnection = ydb_dbapi.connect(\n host=\"localhost\", port=\"2136\", database=\"/local\"\n) # sync connection\n\nasync_connection = await ydb_dbapi.async_connect(\n host=\"localhost\", port=\"2136\", database=\"/local\"\n) # async connection\n```\n\nUsage of connection:\n\n```python\nwith connection.cursor() as cursor:\n cursor.execute(\"SELECT id, val FROM table\")\n\n row = cursor.fetchone()\n rows = cursor.fetchmany(size=5)\n rows = cursor.fetchall()\n```\n\nUsage of async connection:\n\n```python\nasync with async_connection.cursor() as cursor:\n await cursor.execute(\"SELECT id, val FROM table\")\n\n row = await cursor.fetchone()\n rows = await cursor.fetchmany(size=5)\n rows = await cursor.fetchall()\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "YDB Python DBAPI which complies with PEP 249",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/ydb-platform/ydb-python-dbapi/",
"Repository": "https://github.com/ydb-platform/ydb-python-dbapi/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "21d75c939bc8d2cf268f658ef06ff864a44baab88a676d351316f307391da5fd",
"md5": "18eca6aceefd1697fd0d162fe72e7de4",
"sha256": "7e39bd00d381c8ab5098f18d1f3457275a35eb7fa08969cbfb19a3bc9dd720a7"
},
"downloads": -1,
"filename": "ydb_dbapi-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18eca6aceefd1697fd0d162fe72e7de4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 15254,
"upload_time": "2024-12-19T13:53:22",
"upload_time_iso_8601": "2024-12-19T13:53:22.497835Z",
"url": "https://files.pythonhosted.org/packages/21/d7/5c939bc8d2cf268f658ef06ff864a44baab88a676d351316f307391da5fd/ydb_dbapi-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b05e501d369435e2d3b694a6b3138bfa639bd39653dc8281ffa276ccc436355c",
"md5": "a5f3213951268a2c65573bb92568fb46",
"sha256": "66ba65e5ffd7dad0019a566116a5f6e2cfa1cc0073b4bd17330682698e61c3c1"
},
"downloads": -1,
"filename": "ydb_dbapi-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "a5f3213951268a2c65573bb92568fb46",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 14453,
"upload_time": "2024-12-19T13:53:25",
"upload_time_iso_8601": "2024-12-19T13:53:25.505246Z",
"url": "https://files.pythonhosted.org/packages/b0/5e/501d369435e2d3b694a6b3138bfa639bd39653dc8281ffa276ccc436355c/ydb_dbapi-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-19 13:53:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ydb-platform",
"github_project": "ydb-python-dbapi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ydb-dbapi"
}