for instanceallows us to ship pickled python objects across network and provides an alternative to larger protocols such as soap and xml-rpc using per-record pickle files as mentioned earlierone potential disadvantage of this section' examples so far is that they may become slow for very large databasesbecause the entire database must be loaded and rewritten to update single recordthis approach can waste time we could improve on this by storing each record in the database in separate flat file the next three examples show one way to do soexample - stores each record in its own flat fileusing each record' original key as its filename with pkl appended (it creates the files bob pklsue pkland tom pkl in the current working directoryexample - pp \preview\make_db_pickle_recs py from initdata import bobsuetom import pickle for (keyrecordin [('bob'bob)('tom'tom)('sue'sue)]recfile open(key pkl''wb'pickle dump(recordrecfilerecfile close(nextexample - dumps the entire database by using the standard library' glob module to do filename expansion and thus collect all the files in this directory with pkl extension to load single recordwe open its file and deserialize with picklewe must load only one record filethoughnot the entire databaseto fetch one record example - pp \preview\dump_db_pickle_recs py import pickleglob for filename in glob glob('pkl')recfile open(filename'rb'record pickle load(recfileprint(filename'=>\ 'recordsuefile open('sue pkl''rb'print(pickle load(suefile)['name']for 'bob','sue','tomfetch sue' name finallyexample - updates the database by fetching record from its filechanging it in memoryand then writing it back to its pickle file this timewe have to fetch and rewrite only single record filenot the full databaseto update example - pp \preview\update_db_pickle_recs py import pickle suefile open('sue pkl''rb'sue pickle load(suefilesuefile close( sneak preview