...and I also just updated the example on the sqlalchemy site since
it was completely out of date. ill see if i can get it to run later.
On Mar 9, 2006, at 6:48 AM, Qvx 3000 wrote:
I have two tables (Account & Phonebook) with Many-to-Many relationship
implemented using association table (cc_account_phonebook). This
association table has additional columns besides ID columns (weigh). I
would like to have access to those extra columns while accessing list
of related objects.
Here is my simplified model (using ActiveMapper syntax):
account_phonebook_table = Table( "cc_account_phonebook", __engine__,
Column("account_id", Integer, ForeignKey("cc_account.id"),
primary_key=True),
Column("phonebook_id", Integer, ForeignKey("cc_phonebook.id"),
primary_key=True),
Column("weight", Integer))
class AccountPhonebook(object):
pass
AccountPhonebook.mapper = mapper(AccountPhonebook,
account_phonebook_table)
class Account(ActiveMapper):
class mapping:
__table__ = 'cc_account'
id = column(Integer, primary_key=True)
name = column(Unicode(50))
telefon = column(Unicode(40))
from_phonebook = many_to_many("Phonebook",
account_phonebook_table)
# I would like to have access to weight as well
class Phonebook(ActiveMapper):
class mapping:
__table__ = 'cc_phonebook'
id = column(Integer, primary_key=True)
name = column(Unicode(100))
telefon = column(Unicode(20))
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the
live webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users