Build an app with Pony ORM and CockroachDB

Build an app with Pony ORM and CockroachDB

What you build and how you build it should not be dictated by your database. The tools and frameworks that you’re familiar with should be compatible with your database of choice. This is why modern database solutions have implemented support for third part tools like Pony ORM, Hibernate, GORM, jOOQ and others. Developers are beginning to expect to be able to bend the database to their will. And they should - because the flexibility leads to better applications. 

What is Pony Orm?

Pony ORM is a free, open-source Python language library that makes database interactions easy. It’s comparable to Django and SQLAlchemy by virtue of being tied to Python, but it’s distinct because of automatic query optimization, how it solves for the N+1 problem, and the online database schema editor

Software developer Gabriel Llie explains why he uses Pony ORM, “Pony is by far the best SQL ORM for fast prototyping, thanks to its Entity-Relationship Diagram Editor and its pythonic style. It’s my first choice when dealing with a SQL database oriented application. The learning curve is very lean and you can start using it really fast.”

How Does Pony ORM Work?

Developers can query a SQL database in Python syntax, and allow Pony to translate Python queries into SQL and execute them in the most efficient way. But database interactions are only half the battle. Even though Pony ORM simplifies interactions with a database, there are still other database complexities developers have to deal with, like scaling and ensuring the database is always on.

Why Build an App with Pony ORM and CockroachDB?

With Pony ORM for CockroachDB, you’ll get simplicity on both fronts: easy database interactions by virtue of Pony ORM and easy database operations, compliments of CockroachDB. 

CockroachDB shards automatically, is naturally resilient, and is low-maintenance. It never breaks because it’s architected to survive any kind of failure (including whole availability zone failures). There is a large user base and an engaged community where developers can ask questions and get quick answers so that they don’t lose momentum with the build. There are examples of real use cases in production on CockroachDB today. 

With Pony ORM for CockroachDB, you can more efficiently build your apps in Python and gain all the benefits of a distributed SQL database, which include horizontal scale without operational complexity and the luxury of being able to rest easy knowing that your database will survive outages

Getting Started with Pony ORM, Python, and CockroachDB

The best place to get started would be to check out our free course on how to build Python apps with CockroachDB.

If you’re interested in using an ORM with CockroachDB but Pony ORM isn’t your top choice then you can check out all the third party database tools that we support including GORM, Hibernate, jOOQ, Django, SQLAlchemy and more.  

Once you start building you can join the CockroachDB community slack to ask questions and get answers from other users of CockroachDB as well as CockroachDB engineers.

Dan Kelly linkedin link

Dan has been producing technical blogs, videos, whitepapers, and webinars at Cockroach Labs for the last 4+ years. His mission is to identify the most pressing problems developers face and to create content to solve them. Outside of work Dan is usually chasing his three year old daughter or cooking something indulgent.

Keep Reading

Build a Python app with SQLAlchemy + CockroachDB

One of the great things about CockroachDB’s support for SQL is the ecosystem of frameworks, ORMs, and …

Read more
Announcing CockroachDB support for Django ORM


Django includes a full-featured ORM that simplifies interactions with a database--it’s one of the …

Read more
Peewee ORM + CockroachDB

This article was originally posted on the personal blog of the Peewee ORM founder, Charles Leifer. Peewee is a …

Read more