Join Mark Niemann-Ross for an in-depth discussion in this video Read records in SQLite with Python, part of Database Clinic: SQLite.
- [Instructor] Finally, I'm asked to read out…the lines of the play.…This is another repeat of the previous code…and involves only two steps,…read the database then print out each line.…The amount of time this task requires…is highly dependent on how quickly Python prints…rather than how quickly SQLite responds.…In IDLE, let's take a look at the Python code for this.…I go File, Open,…navigate to the exercise files chapter five…and we're going to select Read_Shakespeare.Python.…
Again, much of this code is identical…to previous Python scripts we've already looked at.…The only unique lines in this code are right here…so let's quickly take a look at both of those.…The first line executes an SQL query…called select play_text from midsummer…and all that does is read all the lines of the play.…This line it's a for loop…for aline in myCursor.fetchall.…
myCursor.fetchall is an SQLite command…that grabs all of the lines returned…by the myCursor.execute line…and puts them in the variable called aline one at a time.…Then it goes ahead and prints each line in turn…
- Strengths and weaknesses of SQLite
- Creating a database
- Joining data sets
- Calculations with SQLite and Python
- Searching a database
- Subqueries and queries in SQLite
- CRUD operations in SQLite with R
Skill Level Intermediate
1. SQLite in Five Minutes
2. Create a Database
3. Join Two Datasets
4. Search a Database
5. Create, Read, Update, and Delete Operations
6. Averages and Calculations
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.