Skip to content

Welcome Turu

Turu is a Simple Database Client for Typed Python.

docs test pypi package

logo

Why Turu?

SQL is a powerful language, but it has many dialects, and Cloud Native Databases are especially difficult to test automatically in a local environment.

Turu was developed as a simple tool to assist local development. It provides a simple interface according to PEP 249 โ€“ Python Database API Specification v2.0 and allows for easy recording of query results and injection mock data.

Features

  • ๐Ÿš€ Simple - Turu is a simple database api wrapper of PEP 249.
  • ๐Ÿ’ก Type Hint - Full support for type hints.
  • โšก Async/Await - Async/Await supports.
  • ๐Ÿงช Recoed and Mock - Record and mock database queries for testing.

Usage

import pydantic
import turu.sqlite3


class User(pydantic.BaseModel):
    id: int
    name: str


connection = turu.sqlite3.connect(":memory:")

with connection.execute_map(User, "select 1, 'taro'") as cursor:
    assert cursor.fetchone() == User(id=1, name="taro")