Skip to main content

YDB Dialect for SQLAlchemy

Project description

YDB Dialect for SQLAlchemy


License PyPI version 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

Via PyPI

To install ydb-sqlalchemy from PyPI:

$ pip install ydb-sqlalchemy

Installation from source code

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.9.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

ydb_sqlalchemy-0.1.9-py2.py3-none-any.whl (35.9 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for ydb_sqlalchemy-0.1.9.tar.gz
Algorithm Hash digest
SHA256 8bfd18ffaf8f6945e489ab57fe49950ae2e25c51f992484c7c3ce9e56a224fd2
MD5 0adfd0693289b3c586393b3d3619271d
BLAKE2b-256 9731b72a6cf4df9d1794a8bb500e95660eacfe935e1cfd7cf5569d2803564307

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ydb_sqlalchemy-0.1.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e9149e4ad98758a1a6c5290bda4a5f595a14e1cef1ee65e76c92fc45edc688aa
MD5 f8775283e389c66de0a650c1b489cfc9
BLAKE2b-256 64c98ec91118debf0f80856a2a33d4054c18677e6ce34fba450b7323b4a93c0e

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