skillfed

pypika-tortoise

Forked from pypika and streamline just for tortoise-orm

pypika-tortoise v0.6.5 586.9K downloads/30d#5,879 on PyPI10
Permissive license Apache-2.0 Active released

What it is and what it does

pypika-tortoise is a fork of the pypika SQL query builder, stripped down and adapted specifically for Tortoise ORM. It removes database support and features that Tortoise doesn't use, focusing instead on generating SQL queries efficiently for the ORM's particular use cases. The package exposes a programmatic interface to construct SQL queries—SELECT, WHERE, JOIN, and other clauses—using Python syntax that mirrors the structure of the resulting SQL.

It serves as the query-building layer for Tortoise ORM applications, allowing developers to construct database queries in code rather than writing raw SQL strings. With no external runtime dependencies and support for current Python versions, it integrates cleanly into Tortoise-based projects.

Use it for:

  • Building dynamic SELECT queries programmatically within Tortoise ORM models and migrations
  • Constructing complex WHERE clauses and joins without writing raw SQL strings
  • Generating parameterized queries to prevent SQL injection in Tortoise applications
  • Simplifying query construction in data access layers that use Tortoise ORM

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates SQL queries programmatically for Tortoise ORM, providing a streamlined SQL builder tailored to that ORM's specific needs.

Yes, if you use Tortoise ORM. It's the query builder Tortoise depends on, actively maintained, has no external dependencies, and carries permissive licensing. Install it as part of your Tortoise setup rather than as a standalone choice.

Install

pypika-tortoise on PyPI

pip

pip install pypika-tortoise

uv

uv add pypika-tortoise

poetry

poetry add pypika-tortoise

Installing pypika-tortoise

Before you install

Low install friction with no runtime dependencies. Actively maintained as of March 2026 with recent commits, though the repository has modest visibility (10 stars).

License in practice

Licensed under Apache-2.0, a permissive license that allows commercial and private use with minimal restrictions—suitable for most projects.

Quickstart

pip install pypika-tortoise

from pypika_tortoise import Query, Table

users = Table('users')
q = Query.from_(users).select(users.id, users.name).where(users.active == True)

Requires Python 3.9 or later.

Verify before relying

  • Whether this fork diverges significantly enough from pypika to warrant separate maintenance long-term
  • Performance improvements claimed in the description—no benchmarks provided in the fact sheet

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 154 days since the last release
Last repo commit
First released
Downloads 586,908/month — #5,879 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pypika_tortoise-0.6.5-py3-none-any.whl

Keywords: postgresql, Tortoise-ORM, mysql, sqlite, sql

Tags

tortoise orm sql builderpython sql query generationorm query buildersql construction librarytortoise database queriesprogrammatic sql generationorm query abstraction
sql-builderorm-integration

More Database packages