Skip to main content

YDB Dialect for SQLAlchemy

Project description

YDB Dialect for SQLAlchemy


License Functional tests Style checks

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:

$ pip install -U .

Getting started

Connect to local YDB using 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())

To setup alembic to work with YDB please check this example.

Development

Run Tests:

Run the command from the root directory of the repository to start YDB in a local docker container.

$ docker-compose up

To run all tests execute the command from the root directory of the repository:

$ tox -e test-all

Run specific test:

$ tox -e test -- test/test_core.py

Check code style:

$ tox -e style

Reformat code:

$ tox -e isort
$ tox -e black-format

Run 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ydb_sqlalchemy-0.1.6.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

ydb_sqlalchemy-0.1.6-py2.py3-none-any.whl (35.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ydb_sqlalchemy-0.1.6.tar.gz.

File metadata

  • Download URL: ydb_sqlalchemy-0.1.6.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.8

File hashes

Hashes for ydb_sqlalchemy-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7da357ebfcb2dfee7e2ca546bc9d649087fbc9dd89a03a0588dff1265f0baed0
MD5 0a0b71fb0d99cd6dd03f2a9a95a69165
BLAKE2b-256 f3fa208025c76184cb5a6ab66b655874dd681b3ebec06c10cd5738d91b0e774c

See more details on using hashes here.

File details

Details for the file ydb_sqlalchemy-0.1.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ydb_sqlalchemy-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f08102c77ec5897a5cd62b3773a3157cb3d62ac383c8361f95876d889825f399
MD5 352b0692cbdc05858297bfb4e35e029f
BLAKE2b-256 00c3b62dfa54f92205eaf252e11ecc1d1f5f0b965f24dac2317609fea3f583c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page