
In the previous article, we built our AI Haiku Generator web app using Python Flask in the backend. And HTML, CSS, and Javascript in the frontend. Now we will look at how we can add a database to the stack.
Let's say we want to store all the haiku's that are being generated in a database; we have a couple of options. Generally speaking, there are two types of databases, SQL and NoSQL. Both serve different purposes.
SQL databases are like well-organized libraries, where data is neatly stored in tables with strict rules—great for structured data and complex queries. NoSQL, on the other hand, is like a messy but flexible notebook, allowing you to jot things down without a fixed format—perfect for handling large, dynamic, and unstructured data. The choice depends on whether you prefer order or adaptability.
For our project, we will go ahead with the SQL database. Herein, we again have many options like MySQL and PostgreSQL. Those require setting up from our side, so for the sake of simplicity, we use another database called SQLite.
SQLite is like a portable notebook for your data—lightweight, serverless, and perfect for small projects where simplicity beats complexity.


Write a comment ...