--- id: pony version: "0.7.20" license: Apache-2.0 license_treatment: permissive maintenance: active --- # pony — Pony Object-Relational Mapper License: permissive · Maintenance: active · Downloads: 646.5K/mo ## What it is and what it does Pony is an object-relational mapper that bridges Python and relational databases by translating Python generator expressions and lambdas into SQL. Instead of writing raw SQL or using a separate query DSL, you define your database entities as Python classes and query them using Pythonic syntax—Pony analyzes the abstract syntax tree and generates the appropriate SQL for your target database (SQLite, MySQL, PostgreSQL, or Oracle). The package emphasizes developer productivity through compact entity definitions, readable generated SQL output, and clear error messages that pinpoint problems in your query. It supports interactive use in a Python interpreter and works with modern Python versions (3.10–3.14). With zero runtime dependencies and low install friction, it's designed to let you focus on application logic rather than database plumbing. Use it for: - Build web applications with declarative database models and Pythonic queries instead of raw SQL. - Prototype database schemas interactively using the Pony Entity-Relationship Diagram Editor. - Write data access layers for multi-database applications that need to target SQLite, MySQL, PostgreSQL, or Oracle. - Debug database queries by inspecting the readable SQL that Pony generates from your Python expressions. - Develop applications where you want ORM functionality without heavyweight framework dependencies. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Pony is an object-relational mapper that lets you write database queries using Python generator expressions and lambdas, which it translates to SQL for SQLite, MySQL, PostgreSQL, and Oracle. Yes. Pony is actively maintained, has no runtime dependencies, carries a permissive Apache-2.0 license, and offers a genuinely Pythonic query interface that sets it apart from conventional ORMs. It's well-suited for developers who want to write database queries as Python code rather than SQL strings or builder chains. No known vulnerabilities and broad Python version support (3.10–3.14) make it a low-risk choice. ## Install pip install pony uv add pony poetry add pony ## Installing pony Before you install: Low friction install with no runtime dependencies. Actively maintained as of 2026-08-10 with recent releases and a stable repository. License in practice: Apache-2.0 permissive license allows commercial and private use with minimal restrictions. Quickstart: pip install pony from pony.orm import * db = Database() db.bind('sqlite', ':memory:') class Product(db.Entity): name = PrimaryKey(str) cost = Required(int) db.generate_mapping(create_tables=True) with db_session: select(p for p in Product if p.cost <= 1000) Requires Python 3.10 or later (3.10–3.14 supported). Verify before relying: - Performance characteristics compared to other ORMs for large result sets or complex joins. - Whether the package handles database migrations or schema versioning. - Support status and timeline for Python 3.15 and beyond. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 646.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python orm query generator, database mapper lambda expressions, sql query from python code, object relational mapper, pony orm, python database abstraction, declarative database queries, orm, query-builder, sql-generation [View on SkillFed](https://skillfed.io/packages/pony) · [View on PyPI](https://pypi.org/project/pony/)