Help on module txtdb: NAME txtdb FILE /usr/local/lib/python2.4/site-packages/txtdb.so DESCRIPTION This modules implements txtdb, a text-file based database. txtdb provides a simple, portable, transparent, persistent data store for online and offline application developers. All data is stored in text files that can be independently read or written by other programs. txtdb attempts to satisfy the following three goals: (1) A new user not familiar with databases should be able to learn and use the system in about 15 minutes. (2) It should prevent multiple txtdb application threads or processes from corrupting data. (3) The data store must be human readable and editable. Unlike traditional database systems that typically force clients to connect to a separate database daemon, txtdb is a library that is linked in with an application. Consistency between different threads and different processes is provided using system-level advisory locks. txtdb is an append-only database. Yep, no delete. This means that as data changes, those changes are simply appended to the database. For example, if txtdb is used to store user account information then each change (say an updated password) is just appended to the data store. The next time the affected user's credentials are checked, the application reads only that last entry for that user in the database which has the correct data (in our case the updated password). CLASSES __builtin__.object cursor db Cursor = class cursor(__builtin__.object) | A txtdb read session object | | Methods defined here: | | __init__(...) | x.__init__(...) initializes x; see x.__class__.__doc__ for signature | | next(...) | next() -> dict | Read the next set of key values. DB = class db(__builtin__.object) | A txtdb database instance object | | Methods defined here: | | __init__(...) | x.__init__(...) initializes x; see x.__class__.__doc__ for signature | | append(...) | append(classification, dict | list of key-value tuples) | Append a set of a key-value pairs to a classification which is | specified as a string. | e.g. mydb.append('fruit', {'name':'apple'}) | | read(...) | read(classification, [filter], [lastn]) -> txtdb db object | Open a session for reading tuples from a classification. | An optional filter can be applied by passing a dictionary as the | 'filter=' parameter. Only those key-value pair sets that have | key-values that exactly match the filter dictionary arereturned. | Finally, if the 'lastn=' parameter is specified with an integer | then only the last N entries in the classification will be returned | e.g. c = mydb.read('fruit', {'name':'apple'}, 10) | s = c.next() | while s: | print s | s = c.next() | will print the last 10 sets of key-value pairs from the | classification 'fruit' that have the key value pair 'name':'apple' FUNCTIONS open(...) open(path) -> txtdb DB object Open a txtdb database at path. e.g. mydb = txtdb.open('.')