# 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 using 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:
Run the command from the root directory of the repository to start YDB in a local docker container.
```bash
$ docker-compose up
```
To run all tests execute the command from the root directory of the repository:
```bash
$ tox -e test-all
```
Run specific test:
```bash
$ tox -e test -- test/test_core.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/c0/e0/c85e001109e93b12c2cfb99ae547832dd6cc65d0680e460d002e01156767/ydb_sqlalchemy-0.1.0.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 using 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\nRun the command from the root directory of the repository to start YDB in a local docker container.\n```bash\n$ docker-compose up\n```\n\nTo run all tests execute the command from the root directory of the repository:\n```bash\n$ tox -e test-all\n```\n\nRun specific test:\n```bash\n$ tox -e test -- test/test_core.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.1.0",
"project_urls": {
"Homepage": "http://github.com/ydb-platform/ydb-sqlalchemy"
},
"split_keywords": [
"sqlalchemy",
"ydb",
"yql"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cecdfc906f910ed7b6eb82be569c00e497bd5eda73261d5194f2fb0cc677cfad",
"md5": "e57e01b161d0d1d547eb643e5c264692",
"sha256": "7a15429a6d3ea826e2472749039c525307e5bcb16fa38c650b1c011f780c9cc7"
},
"downloads": -1,
"filename": "ydb_sqlalchemy-0.1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "e57e01b161d0d1d547eb643e5c264692",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 32709,
"upload_time": "2024-11-13T10:00:09",
"upload_time_iso_8601": "2024-11-13T10:00:09.128703Z",
"url": "https://files.pythonhosted.org/packages/ce/cd/fc906f910ed7b6eb82be569c00e497bd5eda73261d5194f2fb0cc677cfad/ydb_sqlalchemy-0.1.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0e0c85e001109e93b12c2cfb99ae547832dd6cc65d0680e460d002e01156767",
"md5": "a09fdffa61cf605ba1938bdb88250a09",
"sha256": "83224f55580b8df2e997bb5a3677c373a40a730840c23e08505f22d625032e43"
},
"downloads": -1,
"filename": "ydb_sqlalchemy-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a09fdffa61cf605ba1938bdb88250a09",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 30118,
"upload_time": "2024-11-13T10:00:10",
"upload_time_iso_8601": "2024-11-13T10:00:10.662932Z",
"url": "https://files.pythonhosted.org/packages/c0/e0/c85e001109e93b12c2cfb99ae547832dd6cc65d0680e460d002e01156767/ydb_sqlalchemy-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 10:00:10",
"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"
}