Looking into the Database
Let's learn how to look into a database using a Flask Shell.
The API only shows game states and not usages or user stats. This is because we have no user story that needs to access those three resources. However, as developers, we might want to see into those tables. How can we do it? We might want to create separate routes that access all the tables. This may be useful at some point, but the purpose of the API is to serve the client. Until the client needs the information, it’s probably better to access it differently. Another option is to access the data using the database’s command-line interface (CLI). This requires learning how to use the sqlite3
and psql
command-line interfaces. A third option, and the one we describe next, is to use the Flask Shell and push a request ...