1. Census case study
Okay, it's time to put all your effort so far to good use on a census case study.
2. Census case study
The case study is broken down into three parts. First, we are going to prepare SQLAlchemy and the database. Next, we will load the data into the database. And finally, we solve a few data science type problems with our query knowledge.
3. Part 1: preparing SQLAlchemy and the database
For part 1 we are going to focus on preparing SQLAlchemy and the database. You might remember this example from Chapter 1. We import create_engine and Metadata, then create the engine and initialize the metadata.
4. Part 1: preparing SQLAlchemy and the database
Then we will build the census table to hold our data. You might remember the employees table we built in Chapter 4. We begin by importing the Table and Column objects along with all the types we are going to use in our table. Next we define our Table using the Table object by giving it a name, the metadata object, and then each of the columns we want in our table. Finally we create the table in the database by using the create all method on the metadata with the engine.
5. Let's practice!
Good luck. Remember to take your time and enjoy the process.