pgcrud: Create, Read, Update, and Delete (CRUD) operations for PostgreSQL made simple and fast

Experience Level: all

pgcrud is a Python library that simplifies CRUD operations for PostgreSQL by seamlessly connecting psycopg and Pydantic. It maps Python data annotations to database objects for efficient, intuitive queries. With pgcrud, you write less code, improve performance, and have full type hint support.


  • Timeslot: Sunday, 6th April 2025, 10:00-11:00, Room D
  • Tags: Data

When building a Python application with PostgreSQL database, most developers either opt for ORMs (like SQLAlchemy or SQLModel) or write raw SQL. Both approaches have their upsides and downsides:

  • ORMs: While convenient, ORMs map directly to tables, but real-world applications often require modeling relationships. This leads to additional data models and more database requests, increasing complexity and overhead.
  • Raw SQL: Writing raw SQL avoids the abstraction but comes with its own challenges, such as repetitive code and difficulty handling optional filters or sorting conditions effectively.

Unlike traditional ORMs, pgcrud uses powerful data annotations to map database objects to Python models only when needed. This drastically reduces the code base and enables highly efficient querying. It offers built-in Pydantic integration and is specifically tailored for PostgreSQL. With pgcrud you can handle parent-children relationships in a single database call and receive a list of Pydantic models as result. Essentially any “n+1” problem can be solved in a single database call.


Danijel Kivaranovic

I am a data science consultant with a PhD in Statistics from Vienna, Austria. I got into Python through Kaggle competitions, where I became a Competition Grandmaster. After founding my own startup, I became heavily involved in software engineering with Python. The Open Source library pgcrud is my way of sharing my passion and expertise with the Python Community.

danijel-kivaranovic