Piccolo, an async query builder and ORM for Python
Tags: python, postgres, fastapi, asyncio
Published: 2021-01-11 00:32:41

I'm happy to introduce [Piccolo](https://github.com/piccolo-orm/piccolo), an async query builder and ORM for Python, which works with Postgres and SQLite.

Some of it's standout features:

## Support for asyncio

Asyncio makes a lot of sense when you want high throughput applications. Piccolo is built on top of [asyncio](https://docs.python.org/3/library/asyncio.html) and a fast database adapter called [asyncpg](https://github.com/MagicStack/asyncpg). You can also use Piccolo within a traditional synchronous app too.

## An admin GUI

Most users of Django will tell you that the admin interface is one of its greatest strengths. It saves developers lots of time, compared to building one from scratch for each project. Piccolo has its own [admin](https://github.com/piccolo-orm/piccolo_admin), which is clean and modern, built using Vue JS.

![Piccolo admin GUI](https://dev-to-uploads.s3.amazonaws.com/i/cgdwqnv3tnvc56pkjrm5.png)

## A backend framework

There are thousands of web frameworks out there, but often they just focus on the view layer, and don't think about the database or security.

Piccolo was designed the other way around - focusing on the data layer first, meaning you can use it with any routing library you wish. Piccolo has out of the box support for [Starlette](https://www.starlette.io/) and [FastAPI](https://fastapi.tiangolo.com/). Other ASGI frameworks integrate with Piccolo really easily.

## Migrations

No ORM is complete without [migrations](https://piccolo-orm.readthedocs.io/en/latest/piccolo/migrations/index.html) - Piccolo ships with them right out of the box.

## Project templates

Piccolo makes [creating a new web app](https://piccolo-orm.readthedocs.io/en/latest/piccolo/asgi/index.html) really simple. Just use `piccolo asgi new`, and a web app template is created for you automatically. Starlette and FastAPI are currently supported.

## Playground

Piccolo makes learning the query syntax as easy as possible, using a [playground](https://piccolo-orm.readthedocs.io/en/latest/piccolo/getting_started/playground.html). Use `piccolo playground run`, and it'll launch an iPython shell, and a test SQLite database, allowing you to practice querying with Piccolo without having to set anything up first.

## SQL inspired

Piccolo's syntax for queries is [as close as possible to SQL](https://piccolo-orm.readthedocs.io/en/latest/piccolo/features/syntax.html). Anyone with SQL experience should find it very natural to use.

```python
>>> await Movie.select(Movie.name).where(Movie.director.name == 'George Lucas').run()
[{'name': 'Star Wars'}]
```

## Modular code

Piccolo allows you to separate your models into [apps](https://piccolo-orm.readthedocs.io/en/latest/piccolo/projects_and_apps/index.html), making your code more maintainable, and meaning you can share them with other people on Github, or PyPI.

## Security

Piccolo has a bunch of associated [middleware, endpoints, and tables](https://github.com/piccolo-orm/piccolo_api) to help build a secure web app.

## Give it a go!

Give Piccolo a go. It is already being used in production, and is improving at a rapid pace. If you have any feedback or questions, let us know on [Github](https://github.com/piccolo-orm/piccolo). Thanks!