dbm databases sql databases database programming |||for most software developers the term database is usually taken to mean an rdbms (relational database management systemthese systems use tables (spreadsheet-like gridswith rows equating to records and columns equating to fields the tables and the data they hold are created and manipulated using statements written in sql (structured query languagepython provides an api (application programming interfacefor working with sql databases and it is normally distributed with the sqlite database as standard another kind of database is dbm (database managerthat stores any number of key-value items python' standard library comes with interfaces to several dbmsincluding some that are unix-specific dbms work just like python dictionaries except that they are normally held on disk rather than in memory and their keys and values are always bytes objects and may be subject to length constraints the shelve module covered in this first section provides convenient dbm interface that allows us to use string keys and any (picklableobjects as values if the available dbms and the sqlite database are insufficientthe python package indexpypi python org/pypihas large number of database-related packagesincluding the bsddb dbm ("berkeley db")and interfaces to popular client/server databases such as db informixingresmysqlodbcand postgresql using sql databases requires knowledge of the sql language and the manipulation of strings of sql statements this is fine for those experienced with sqlbut is not very pythonic there is another way to interact with sql databases--use an orm (object relational mappertwo of the most popular orms for python are available as third-party libraries--they are sqlalchemy (www sqlalchemy organd sqlobject (www sqlobject orgone particularly nice feature of using an orm is that it allows us to use python syntax--creating objects and calling methods--rather than using raw sql