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:56:13
|
On Mon, 2003-07-28 at 03:31, Fran=E7ois Girault wrote: > Hi all, >=20 > in some cases, there's additionnal datas in relation table. For > example, the rank if the relation is ordered, or a lock object for > edition...=20 I'm not entirely clear on what you want here. I think you are describing a whole set of features, and maybe you're thinking about how to describe those. I'm not actually very happy with the _columns (now defunct), _idName, _joins, etc., style. So alternative syntaxes are good. If the feature needs a name (like columns and joins do), then attributes is the way to go. Neither ordering or locks need a name, though -- they would be used implicitly in other areas. __order__ and __lock__ are possibilities -- at least they are obviously magic, but I'm also a little reluctant to overuse the double-underscore variables. Though I don't really believe the idea that double underscore variables are preserved for Python. Python grows such variables very slowly. I'm open to other ideas. Nested classes, like: class InvoiceItem(SQLObject): invoiceOrder =3D IntCol() class meta: orderBy =3D invoiceOrder lock =3D 'optimistic' Certainly easily extensible, without a not-so-bad syntax. It would lead to the separate mapping object that some people sometime want... But maybe that's not what you are asking about ;) I'm not entirely clear on the rest of this... > It's very common to see that. >=20 > So I'm thinking about how to implement this : >=20 > - one (ugly but usuable) way to do that without modifying SQLObject > is to describe the join like an entity with 2 foreign keys, and then > specifying the additionnal columns as usual. >=20 > - a cleaner way would be to add the columns to the join declaration, > and then attach these columns to the entities retrevied when > performing the join. I don't think this would be threadsafe -- things shouldn't be attached to SQLObject instances unless they really belong to the instance, not the instance in a specific context. But as I reread this, I'm really not clear about what you're trying to do. An example might clarify (though I probably won't be able to follow up) Ian |