Stefan Baerisch

I started working with Python 2.5 around 2006 to build what might a called a micro-service backend for our company's search backend. In continued to use Python when I did Ph.D. research in automated testing, and I have always been happy with the boost in productivity that Python and Django gave me.

Since then, I have continued to use Python. Sometimes as part of a customer project, sometimes to automate tedious tasks, and sometimes just for fun.
Since 2020, I work as a freelancer in multiple roles.


The speaker's profile picture


(A) SQL for Django
Stefan Baerisch

Django's ORM is full-featured, simple to use, and well-suited for almost all interactions with your database. But sometimes, to get better performance or to get data in just the format that you need, it is useful to have the full expressiveness of SQL in your Django application.

In this talk, we will look at using SQL with Django. We will see in which situations the use of SQL makes most sense. You will see the power of SQL and the best ways to use SQL with Django.

We will start with a short review of SQL and of use cases for which SQL gives you more fine-grained control and better results than Djangos ORM. Then, we look at raw SQL queries and RawQuerySets. RawQuerySets make it possible to get model instances with custom SQL. Finally, we learn how to directly work with Django SQL connections and use SQL change your data or get results that don't fit any particular model instance.

Main Room