Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

pingcap/sqlalchemy-tidb

Repository files navigation

sqlalchemy-tidb

.github/workflows/ci.yml

This adds compatibility for TiDB to SQLAlchemy.

Supported versions

  • TiDB 4.x and newer
  • SQLAlchemy 1.4.x
  • Python 3.8 and newer

Installation

pip install git+https://github.com/pingcap/sqlalchemy-tidb.git@main

Getting Started

In your Python app, you can connect to the database via:

from sqlalchemy import create_engine
engine = create_engine("tidb://username:password@ip:port/database_name?charset=utf8mb4")

Known issues

  • TiDB only support FOREIGN KEY constraints since v6.6.0(#18209).
  • TiDB only support SAVEPOINT since v6.2.0(#6840).

Testing this dialect with SQLAlchemy and Alembic

Bootstrap your environment with virtualenv and requirements installed

make bootstrap

You can run the tests using the following command:

make all
# Or running test with `tox` for a specified python version
tox -e py39
# Or running test directly using `pytest`
pytest "test/test_suite.py::DateTest"

To know more about developing the TiDB dialect, checkout the guide on sqlalchemy:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages