Session
Back
The How and Why of Method Chaining with SQLAlchemy in PostgreSQL
Date: 2019-09-13
Time: 18:30 - 19:20
Room: Salon 17-18
Level: Beginner
As new software engineers, it was helpful to learn about method chaining when building our first full-stack web applications. In talking with fellow junior engineers, the concept of “method chaining” was not as widely adopted or understood as we had anticipated. Using SQLAlchemy method chaining with our PostgreSQL databases allowed us to reduce query count per RESTful API route, thereby improving runtime of our apps. We feel that sharing our experience could help other junior engineers improve their web apps and projects, as well.
What/Why of chaining
- Method chaining - a pattern that allows more succinct code when multiple calls are made to the same object
- Reduce # of queries, improve runtime on your web app
Chaining queries in PostgreSQL vs chaining methods in SQLAlchemy
- Note: we have experience with SQLAlchemy ORM, which is specific to Python, but other ORMs exist
- Overview of ORM, and benefits of forming relations between your db’s tables (via associated classes you create)
How we used method chaining with SQLAlchemy and PostgreSQL in our projects
- Demos of Hackbright Academy Capstone projects
- Code overview - code samples of without and with use of method chaining
Speaker
Hannah Johnson
Leah Liu