[Twisted-Python] Enterprise Row Objects

Sean Riley sean at twistedmatrix.com
Tue Sep 24 02:13:48 EDT 2002

also successfully ran the row_example.py test against Interbase/Firebird
using kinterbasdb python DBAPI driver and MySQL using the MySQLdb driver :)

-----Original Message-----
From: twisted-python-admin at twistedmatrix.com
[mailto:twisted-python-admin at twistedmatrix.com]On Behalf Of Sean Riley
Sent: Monday, September 23, 2002 10:57 PM
To: twisted-python at twistedmatrix.com
Subject: [Twisted-Python] Enterprise Row Objects

I found that if I can remove all of the database implementation specific
code and the database initialization phase for reflectors if the class
attribute "rowColumns" is extended to include the type of the column in
addition to its name.

so when users define a new row class,

rowColumns = ["col1", "col2", "col3"]


rowColumns = [("col1", "int"), ("col2", "varchar"), ("col3", "int")]

Itamar pointed me at PySQLite ( http://www.hwaci.com/sw/sqlite/ and
http://pysqlite.sourceforge.net/ ) and i couldnt implement a reflector for
it because there is no way to determine the type of a column as SQLite lacks
detailed system catalogs. Adding the type information to rowColumns was the
obvious solution and happily it has additional benefits:
 - no longer require a database catalog lookup to populate rowClasses
 - no defered initialization phase for reflectors
 - databases without full schema information available (XML and SQLite) can
be supported.

So, the SQL Reflector now works purely on the python DBAPI spec - it should
work with any supported  python DBAPI module. I've run it with PostgreSQL
and SQLite. I'd like to hear if anyone can run it on another database or

In Twisted.doc.examples there is now:

	row_util.py  - classes for row examples
	row_schema.sql - sample database schema
	row_example.py - example code using a postgresql or sqlite database
	row_xml.py  - example code that uses an XML "database"

Additional functionality would be the ability to generate stubbed rowObject
classes from a relational database schema.

...and I wont update the documentation with PageMill.

"If he's so smart, then how come he's dead?", Homer Simspon
Sean Riley
sean at ninjaneering.com

Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list