On Mar 11, 2009, at 6:17 PM, Scott wrote:
>
> When I do this...
>
> cpt_codes = ManyToMany(
> ...
> order_by = procedure_cpt_codes.c.cpt_codes_idx
> )
>
> # procedure_cpt_codes is the JOIN table in between the parent
> (procedure) <---< children (cpt_codes)
> # procedure_cpt_codes has 3 column
When I do this...
cpt_codes = ManyToMany(
...
order_by = procedure_cpt_codes.c.cpt_codes_idx
)
# procedure_cpt_codes is the JOIN table in between the parent
(procedure) <---< children (cpt_codes)
# procedure_cpt_codes has 3 columns...procedure_id (foreign key),
cpt_code_id (foreign key) and
order_by accepts a Column object, i.e. table.c.whatever, so pass that in.
Scott wrote:
>
> Is there a way with the current iteration of SQLAlchemy to add a
> column to the association table in a many-to-many relationship with
> that column used to order the join? I looked at the order_by attribut
as of 0.3, more or less...technically it just insures that "delete"
and "delete-orphan" is enabled. the 0.2 series had special logic
for associations like this (which was broken in some cases) where it
would do the right thing if you removed one KeywordAssociation, and
added another Keyw
The diffs are a little hard when you're not sure where the line breaks
are (and the cascade all appears to be on the wrong line to me) but
just for my own sanity, you're saying that:
mapper(Item, items,
properties={'keywords':relation(KeywordAssociation,
cascade="all,delete-orphan")})
is equival
I thought for a while that what you were doing couldnt work right now.
this is because a join to the KeywordAssociation object doesnt know
anything about the next join to Keyword. but then actually, i realized
you could do it, but it does require that the relation from
keywordassociation to keywo