# YDB Dialect for SQLAlchemy
---
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/LICENSE)
[![Functional tests](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)
[![Style checks](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml)
This repository contains __work in progress__ YQL dialect for SqlAlchemy 2.0.
Api may be changed in future without backward compatibility.
## Installation
To work with current ydb-sqlalchemy version clone this repo and run from source root:
```bash
$ pip install -U .
```
## Getting started
Connect to local YDB throw SqlAlchemy:
```python3
import sqlalchemy as sa
engine = sa.create_engine("yql+ydb://localhost:2136/local")
with engine.connect() as conn:
rs = conn.execute(sa.text("SELECT 1 AS value"))
print(rs.fetchone())
```
## Development
### Run Tests:
For run local YDB throw docker, run in source root:
```bash
$ docker-compose up
```
For run all tests from source root make:
```bash
$ tox -e test-all
```
Run specific test:
```bash
$ tox -e test -- test_dbapi/test_dbapi.py
```
Check code style:
```bash
$ tox -e style
```
Reformat code:
```bash
$ tox -e isort
$ tox -e black-format
```
Run example (needs running local YDB):
```bash
$ python -m pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ python examples/example.py
```
Raw data
{
"_id": null,
"home_page": "http://github.com/ydb-platform/ydb-sqlalchemy",
"name": "ydb-sqlalchemy",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "SQLAlchemy YDB YQL",
"author": "Yandex LLC",
"author_email": "ydb@yandex-team.ru",
"download_url": "https://files.pythonhosted.org/packages/13/00/529429713d26f5ebbfe72a3c6b22b28b01cffc7e3f903d9ca14f6852d41f/ydb_sqlalchemy-0.0.1b14.tar.gz",
"platform": null,
"description": "# YDB Dialect for SQLAlchemy\n---\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/LICENSE)\n[![Functional tests](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)\n[![Style checks](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml)\n\nThis repository contains __work in progress__ YQL dialect for SqlAlchemy 2.0.\nApi may be changed in future without backward compatibility.\n\n## Installation\nTo work with current ydb-sqlalchemy version clone this repo and run from source root:\n\n```bash\n$ pip install -U .\n```\n\n## Getting started\n\nConnect to local YDB throw SqlAlchemy:\n\n```python3\nimport sqlalchemy as sa\n\n\nengine = sa.create_engine(\"yql+ydb://localhost:2136/local\")\n\nwith engine.connect() as conn:\n rs = conn.execute(sa.text(\"SELECT 1 AS value\"))\n print(rs.fetchone())\n\n```\n\n## Development\n\n### Run Tests:\n\nFor run local YDB throw docker, run in source root:\n```bash\n$ docker-compose up\n```\n\nFor run all tests from source root make:\n```bash\n$ tox -e test-all\n```\n\nRun specific test:\n```bash\n$ tox -e test -- test_dbapi/test_dbapi.py\n```\n\nCheck code style:\n```bash\n$ tox -e style\n```\n\nReformat code:\n```bash\n$ tox -e isort\n$ tox -e black-format\n```\n\nRun example (needs running local YDB):\n```bash\n$ python -m pip install virtualenv\n$ virtualenv venv\n$ source venv/bin/activate\n$ pip install -r requirements.txt\n$ python examples/example.py\n```\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "YDB Dialect for SQLAlchemy",
"version": "0.0.1b14",
"project_urls": {
"Homepage": "http://github.com/ydb-platform/ydb-sqlalchemy"
},
"split_keywords": [
"sqlalchemy",
"ydb",
"yql"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a01269daa05f763a1ffe0fe7fdb9b436d90fdea9a76afdadcf36b2ed2449f795",
"md5": "a3c666ccca86b838746e63c20022247e",
"sha256": "01d65fb9e5b3bf890ecd0ed2f79a03c760cd2ae0c144577cf0615f50749e183f"
},
"downloads": -1,
"filename": "ydb_sqlalchemy-0.0.1b14-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "a3c666ccca86b838746e63c20022247e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 38435,
"upload_time": "2024-04-22T13:25:28",
"upload_time_iso_8601": "2024-04-22T13:25:28.398129Z",
"url": "https://files.pythonhosted.org/packages/a0/12/69daa05f763a1ffe0fe7fdb9b436d90fdea9a76afdadcf36b2ed2449f795/ydb_sqlalchemy-0.0.1b14-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1300529429713d26f5ebbfe72a3c6b22b28b01cffc7e3f903d9ca14f6852d41f",
"md5": "cd288b1749c9ac1b7f6e72d3a66c1eb6",
"sha256": "83290014909eab6cda23a2aef43d476d10201077b3dfc9446e3e38873b1928ce"
},
"downloads": -1,
"filename": "ydb_sqlalchemy-0.0.1b14.tar.gz",
"has_sig": false,
"md5_digest": "cd288b1749c9ac1b7f6e72d3a66c1eb6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 34370,
"upload_time": "2024-04-22T13:25:29",
"upload_time_iso_8601": "2024-04-22T13:25:29.681584Z",
"url": "https://files.pythonhosted.org/packages/13/00/529429713d26f5ebbfe72a3c6b22b28b01cffc7e3f903d9ca14f6852d41f/ydb_sqlalchemy-0.0.1b14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-22 13:25:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ydb-platform",
"github_project": "ydb-sqlalchemy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "ydb-sqlalchemy"
}