Querying SQLite from Python
In our Querying SQLite from Python mission, you’ll learn how to query a SQLite database using the sqlite3 library.
Being able to write SQL queries using Python can be quite beneficial. Otherwise, you would find yourself writing code in Python, exporting data from Python, importing that in a separate program you have that can query data, saving that data, and importing it back into Python. That would be, needless to say, a cumbersome process!
In this mission, you will learn how to avoid that process by writing queries for a SQLite database from within Python using the sqlite3 library. As you progress through the mission, you will get familiar with connecting to SQLite databases and build experience with the SQL query workflow.
Throughout this mission, you’ll also continue your analysis of the 2010-2012 college grade data to give you practice using SQL to solve real-world data science problems.
2. Introduction to the Data
3. Connecting to the Database
4. Introduction to Cursor Objects and Tuples
5. Working With Sequences of Values as Tuples
6. Creating a Cursor and Running a Query
7. Execute as a Shortcut for Running a Query
8. Fetching a Specific Number of Results
9. Closing the Database Connection
11. Next Steps