1.5.1.2 Compared To Other Database Wrappers

There are several object-relational mappers for Python and a series of basic database wrappers similar to web.database. The authour cannot comment deeply on these.

web.database.object is most similar to SQLObject available from http://www.sqlobject.org in that it creates objects that feel similar to normal Python objects and can be accessed and manipulated in a familiar way.

Modules like SQLObject and web.database.object differ from modules such as PyDO or the web.database module which simply provide more Python-like ways of executing SQL queries and then package up the database returns into more useable forms such as dictionaries. The web.database.object completely removes any need to know any SQL. You just manipulate the objects themselves and the rest is done for you. This makes SQL programming extremely simple and still gives you full control over the information stored in the database.

What separates web.database.object from some other software is the strong typing of the data. If you are accessing the property of a Date field the object will be a datetime.Date object. If you are setting an Email field, only strings in the format of an email address will be allowed. The module also direct support for one-to-many and many-to-many mappings which means you can build complex data structures.

Because the software interfaces the database through a web.database cursor (in principle it could interface to other drivers as well) the code written will be database independant and run on any database supported by the web.database module.

web.database.object uses classes derived from Table, Database and web.form.field classes to facilitate this integration. Some ORMs use code generation to create an interface, expressing the schema in a CSV or XML file (for example, MiddleKit, part of Webware). By using normal Python objects you are able to comfortably define your database in the Python source code. No code generation, no weird tools, no compilation step.

What truly separates web.database.object from any other ORM in any language (to the authour's knowledge - correct me please if I am wrong) is that on top of all the features mentioned above, the columns used to store the SQL data are also instances of web.form.field.typed and the tables have the ability to generate web.form Form objects. This means it is possible to create HTML interfaces to edit the database data automatically and in such a way that the user can only enter valid data otherwise the user will be asked to make corrections. This functionality makes building complex web databases much simpler.