This repository contains work in progress YQL dialect for SqlAlchemy 2.0. Api may be changed in future without backward compatibility.
To work with current ydb-sqlalchemy version clone this repo and run from source root:
$ pip install -U .Connect to local YDB throw SqlAlchemy:
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())For run local YDB throw docker, run in source root:
$ docker-compose upFor run all tests from source root make:
$ tox -e test-allRun specific test:
$ tox -e test -- test_dbapi/test_dbapi.pyCheck code style:
$ tox -e styleReformat code:
$ tox -e black-formatRun example (needs running local YDB):
$ python -m pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ python examples/example.py