PyBay 2019: Talking about Python in SF

Felipe Farias
August 16, 2019
<figure class="kg-card kg-image-card"><img src="" class="kg-image" alt="Alt text"></figure><p><br>We are back to San Francisco! Our team will be joining <a href="">PyBay's conference</a>, one of the biggest Python events in the Bay Area. For this year, we'll be giving the talk: Building effective Django queries with expressions.</p><p>PyBay has been a fantastic place to meet new people, connect with new ideas, and integrate this thriving community.</p><p>Here is the slide from the talk we gave during the conference:</p><h3 id="building-effective-django-queries-with-expressions">Building Effective Django Queries with Expressions</h3><ul><li>Speaker: <a href="">Vanessa Barreiros</a></li><li>Link to Slides: <a href="">Building Effective Django Queries with Expressions</a></li></ul><p>In Django, we have a powerful tool called ORM to manipulate databases easily. For small queries, it can be quite simple, but what happens when you need to do tricks like nested queries or computed values? One of the answers is query expressions. In this talk, we'll learn how to power-up queries with them by walking through comparisons and examples with a dataset.</p><p>It's known that ORMs are a powerful tool to manipulate databases with ease. In Django, there are a set of out-of-the-box abstractions to help perform queries and shape them through annotations, aggregations, order by, and so on, hence saving one's time. A common solution to filtering when models grow larger over time is creating redundant fields; a better solution is using Django built-in resources called query expressions.</p><p>Query expressions are smart yet straightforward functions that one can use to compute values on query execution and do string manipulation, calculations, among others, thus removing the burden of having unnecessary extra columns in our database. Using query expressions effectively can help to generate performant queries, avoiding potential inconsistencies and separating concerns.</p><p>This talk focuses on further optimizing Django queries by walking through code comparisons and examples with a dataset, diving into subjects such as custom database functions, conditional expressions, and filtering so to answer questions about the data.</p>