8 Building a CRUD app with Streamlit
This chapter covers
- Setting up a relational database for persistent storage
- Performing CRUD operations using SQL
- Developing a multi-page Streamlit app
- Creating shared database connections in a Streamlit app
- Authenticating users
In 1957, science fiction author Theodore Sturgeon famously said, "Ninety percent of everything is crud." While this was originally a cynical defense of the science fiction genre—the point being that it was no different from anything else in that regard—the adage has since taken on a different meaning, becoming the worst-kept secret in software engineering: Ninety percent of everything is CRUD.
By CRUD, I'm referring to Create, Read, Update, and Delete, the four mundane operations that appear repeatedly in almost any notable piece of software.
Think about it. Social media platforms like Facebook revolve around creating posts, reading feeds, updating profiles, and deleting content. E-commerce sites manage products, orders, customer accounts, and reviews through similar operations. Even something as simple as Notepad on Windows centers around creating, reading, updating, and deleting text files.
Mastering CRUD operations is essential for building a strong foundation in software design, as their implementation often involves tackling non-trivial challenges. In this chapter, we'll create a CRUD application with Streamlit, implementing these operations from scratch while covering related topics such as user authentication.