Class 9 Prep Review

Here are some review questions for you to solidify your knowledge of the concepts covered in this class:

  1. What is the relationship between a Python class and a table used to persist that class in a database? In other words, what aspect of a table does a class's property relate to or represent? And what aspect of a table does an instance of a class relate to or represent?

  2. Instead of deleting a row from a database, how could you flag it so that your program knows not to select it from the database? What are the benefits of doing this rather than deleting the data?

  3. When you declare a field/column to be a primary key using SQLAlchemy, do you need to pass in an integer to the database? Why or why not?

  4. What two commands do you use to delete and recreate a table using the Python shell? Do you keep the data that was in your table when you do these commands?

  5. What are two primary causes of your program not running when it utilizes a database?