Re: [SQLObject] Additionnal datas on joins
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Ian B. <ia...@co...> - 2003-08-01 01:59:32
|
On Mon, 2003-07-28 at 08:41, Brad Bollenbach wrote:
> The cleanest way is to figure out how we want to define composite
> primary keys.
>
> Like this?
>
> class SiteMonitor(SQLObject):
> site = ForeignKey("Site")
> monitor = ForeignKey("Monitor")
>
> _primary_key = (site, monitor)
I'm thinking:
id = ('site', 'monitor')
or:
id = (site, monitor)
both should be equivalent.
This goes along with using:
id = StringCol()
when you have a non-integer primary key.
When using a composite keys, obj.id should return a tuple of the
respective columns -- ids should be hashable and immutable, which fits
tuples nicely.
Ian
|