database programming ||sql databases interfaces to most popular sql databases are available from third-party modulesand out of the box python comes with the sqlite module (and with the sqlite database)so database programming can be started right away sqlite is lightweight sql databaselacking many of the features ofsaypostgresqlbut it is very convenient for prototypingand may prove sufficient in many cases to make it as easy as possible to switch between database backendspep (python database api specification provides an api specification called db-api that database interfaces ought to honor--the sqlite modulefor examplecomplies with the specificationbut not all the third-party modules do there are two major objects specified by the apithe connection object and the cursor objectand the apis they must support are shown in tables and in the case of the sqlite moduleits connection and cursor objects both provide many additional attributes and methods beyond those required by the db-api specification the sql version of the dvds program is dvds-sql py the program stores directors separately from the dvd data to avoid duplication and offers one more menu option that lets the user list the directors the two tables are shown in figure the program has slightly fewer than lineswhereas the previous section' dvds-dbm py program is slightly fewer than lineswith most of the difference due to the fact that we must use sql queries rather than perform simple dictionary-like operationsand because we must create the database' tables the first time the program runs dvds id title year duration director_id directors id name figure the dvd program' database design the main(function is similar to beforeonly this time we call custom connect(function to make the connection def connect(filename)create not os path exists(filenamedb sqlite connect(filenameif createcursor db cursor(