[Twisted-Python] Enterprise Rowobject and generating primary keys

Guenther Starnberger sysfrog at gmail.com
Thu May 27 17:25:39 EDT 2004

Hi all,

I have a problem creating primary key values for enterprise rowobjects.

The KeyFactory class says "This is deprecated. Use the underlying
database to generate keys, or just roll your own.". As I am using
Postgresql the ideal solution would be to just use the 'nextval'
function (which is used as default value for the primary key in my
schema, therefore I could skip this column in my insert statement).

The problem now is, that I need to assign a value to the rowobject
primary key column, otherwise i get an exception from twisted
('instance has no attribute...'). Just excluding the primary key
column from my rowColumns attribute doesn't work either as this
results in twisted to hang. Manually selecting the nextval function
with the adbapi and using the result as primary key works, but this
solution isn't really nice.

Any other proposals for an elegant solution to create primary keys
when inserting new rowobjects?


More information about the Twisted-Python mailing list