[Twisted-Python] Questions about class KeyFactory.

Rich Cavanaugh rich at enflyer.com
Wed Dec 8 12:02:58 EST 2004


On Dec 8, 2004, at 8:52 AM, Thomas Kristensen wrote:

>
>
>> What happens if you set the id to a zero value of some sort, such as 
>> 0,
>> '', NULL ?
>
> I have tried that aswell, they either gives an invalid sql, or is 
> rejected by PG :(
>
> b.assignKeyAttr("testId", None) =
> libpq.OperationalError: ERROR:  null value in column "testid" violates 
> not-null constraint

I have quite a lot of local changes to twisted.enterprise that I would 
be happy to share. The code is a mess right now though and kinda pgsql 
specific so if you want it keep that in mind.

With my changes you would do:

b.assignKeyAttr("testId", PgDefaultColumn())

or

b.assignKeyAttr("testId", PgSequenceColumn("mytable_testId_seq"))

There are a lot of other changes but those are the ones most relevant 
to your problem.

rich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2361 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20041208/db64314e/attachment.bin 


More information about the Twisted-Python mailing list