On Thu, 2003-07-31 at 04:18, Luc Stepniewski wrote:
> Hello,
>
> I'm trying to understand how SQLObject works, but I'm having problem
> understanding the generated tables:
>
> If I want to create two tables, with one that has a relation one-to-many to
> the other, I define an attribute with the ForeignKey() method, but when I do
> this, I notice that there are no *real* restriction on the usage of that
> generated column in the database (I'm using PostgreSQL). Here are more
> explanations:
No, SQLObject doesn't put in the REFERENCES constraint. You can
certainly make a CREATE statement yourself instead of letting SQLObject
do that, or you could do (untested):
ForeignKey('societe', sqlType='INT REFERENCES societe (id)')
Perhaps at some point we'll fix ForeignKey to do the right thing.
Ian
|