ydb-sqlalchemy


Nameydb-sqlalchemy JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttp://github.com/ydb-platform/ydb-sqlalchemy
SummaryYDB Dialect for SQLAlchemy
upload_time2024-12-19 14:06:10
maintainerNone
docs_urlNone
authorYandex LLC
requires_pythonNone
licenseApache 2.0
keywords sqlalchemy ydb yql
VCS
bugtrack_url
requirements sqlalchemy ydb ydb-dbapi
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 YQL dialect for SqlAlchemy 2.0.

**Note**: Dialect also works with SqlAlchemy 1.4, but it is not fully tested.


## 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())

```

To setup `alembic` to work with `YDB` please check [this example](https://github.com/ydb-platform/ydb-sqlalchemy/tree/main/examples/alembic).

## 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/02/29/720d3d499ea61cf88f75931bd2ba2684ef1bcda9ebf5b9be0c76daf6a15e/ydb_sqlalchemy-0.1.5.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 YQL dialect for SqlAlchemy 2.0.\n\n**Note**: Dialect also works with SqlAlchemy 1.4, but it is not fully tested.\n\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\nTo setup `alembic` to work with `YDB` please check [this example](https://github.com/ydb-platform/ydb-sqlalchemy/tree/main/examples/alembic).\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.5",
    "project_urls": {
        "Homepage": "http://github.com/ydb-platform/ydb-sqlalchemy"
    },
    "split_keywords": [
        "sqlalchemy",
        "ydb",
        "yql"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a26885edc554ca034e030c596a71a26cd3136a9b398eb14466fb7b808be8f2f9",
                "md5": "c8cd0f65ff4425947c7f9d5bc6928201",
                "sha256": "cb749810bfcd590ab2d650e3c396d37299135113a667844c6c66af09eb72b9d0"
            },
            "downloads": -1,
            "filename": "ydb_sqlalchemy-0.1.5-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c8cd0f65ff4425947c7f9d5bc6928201",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 35456,
            "upload_time": "2024-12-19T14:06:08",
            "upload_time_iso_8601": "2024-12-19T14:06:08.360125Z",
            "url": "https://files.pythonhosted.org/packages/a2/68/85edc554ca034e030c596a71a26cd3136a9b398eb14466fb7b808be8f2f9/ydb_sqlalchemy-0.1.5-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0229720d3d499ea61cf88f75931bd2ba2684ef1bcda9ebf5b9be0c76daf6a15e",
                "md5": "c6261721e82d466b7cb5f02318aefb61",
                "sha256": "8a56f27e07a192a64ba1be99daa86b2117fac5c90b3539cca3afc735b0c152d3"
            },
            "downloads": -1,
            "filename": "ydb_sqlalchemy-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "c6261721e82d466b7cb5f02318aefb61",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 31092,
            "upload_time": "2024-12-19T14:06:10",
            "upload_time_iso_8601": "2024-12-19T14:06:10.627912Z",
            "url": "https://files.pythonhosted.org/packages/02/29/720d3d499ea61cf88f75931bd2ba2684ef1bcda9ebf5b9be0c76daf6a15e/ydb_sqlalchemy-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-19 14:06: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": [
        {
            "name": "sqlalchemy",
            "specs": [
                [
                    "<",
                    "3.0.0"
                ],
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "ydb",
            "specs": [
                [
                    ">=",
                    "3.18.8"
                ]
            ]
        },
        {
            "name": "ydb-dbapi",
            "specs": [
                [
                    ">=",
                    "0.1.6"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "ydb-sqlalchemy"
}
        
Elapsed time: 0.39254s