3 Managing Data


  • What data persistence means
  • How to store data in files
  • How to store data in a database
  • How databases search, sort, and access data
  • Other options for data storage


For this chapter the wrox.com code downloads are found at www.wrox.com/go/pythonprojects on the Download Code tab. The code is in the Chapter 3 download, called Chapter3.zip, and individually named according to the names throughout the chapter.

In many scenarios you need to store data between executions of your program. The data you want to store could be local status information, such as the current location in an e-book reader or the current working filename, or it could be administrative data such as usernames and passwords or server addresses. Often it will be large volumes of business-oriented data such as customer orders, inventory, or address information. Many business applications consist of little more than a mechanism to create, view, and edit stored data.

This capability to store data in such a way that it is available for use on subsequent invocations of your program is known as data persistence because the data persists beyond the lifetime of the process that created it. To implement data persistence you need to store the data somewhere, either in a file or in a database.

This chapter is a bit like a history of computing storage technologies. That’s because the need to store data has grown—and continues to grow—ever ...

Get Python Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.