[Twisted-Python] enterprise.row and two-way relationships

Justin Ryan justin at gnubian.org
Sun Oct 20 18:49:37 EDT 2002


> Ah! Ok...now I'll show my lack of attention. I didn't pay attention to
> the twisted.enterprise.ROW reference!
> 
> Well...the row stuff looks pretty wonky to me *grin*, but since I want
> to understand it as well, we can figure it out together. 

admittedly, it does.. I'm embarrassed to admit that I'm currently using
a pretty lame db access method..

The Python Cookbook outlines a LazyDB class (aptly named at that) which
implemens Connection, Record and RecordSet objects (though I honestly
don't see why it couldn't be done with a list of Records).. 

As it is implemented, it doesn't seem feasible to subclass the Record
object, which means I can't implement objects for each of my tables..

> Is the following a good minimalist schema for the objects?
> 
> account (
> accountid integer,
> name varchar(100),
> )
> 
> contact (
> contactid integer,
> fname varchar(100),
> lname varchar(100),
> email varchar(100)
> )
> 
> rel (
> accountid integer,
> contactid integer
> )
> 
> If you've got better field names, just let me know. I just want to be
> able to talk apples to apples...

I've got a few more fields in the contact table, but we can work with id
and name..

If you check the other reply to my post, I tried the create view method
and it seems like it will work, but still makes for messy integration
with row, since i'll have to define three rows - one for accounts, one
for contacts, and one for the integrated view (although honestly, the
account table will rarely be accessed without the full view).

Thanks!

-Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20021020/cd32b6ff/attachment.pgp 


More information about the Twisted-Python mailing list