I would've declared the relation from Country to CountryLanguage, not vice versa, but I doubt that is the reason for your error.
Can you provide a full example which reproduces the error? Barry ----- Original Message ---- From: mmstud <[EMAIL PROTECTED]> To: sqlalchemy <sqlalchemy@googlegroups.com> Sent: Saturday, October 27, 2007 8:02:38 AM Subject: [sqlalchemy] associative table with extra field I'm trying to implement associative table with extra field on join table, but faced problems... what is it, that im doing wrong here, because i get python error: . . . 2007-10-27 14:58:26,816 INFO sqlalchemy.engine.base.Engine.0x..d0 {} 2007-10-27 14:58:26,816 INFO sqlalchemy.engine.base.Engine.0x..d0 COMMIT ERROR: Internal Python error in the inspect module. Below is the traceback from this internal error. Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/IPython/ultraTB.py", line 462, in text records = _fixed_getinnerframes(etb, context,self.tb_offset) File "/usr/lib/python2.4/site-packages/IPython/ultraTB.py", line 118, in _fixed_getinnerframes records = inspect.getinnerframes(etb, context) File "inspect.py", line 804, in getinnerframes framelist.append((tb.tb_frame,) + getframeinfo(tb, context)) File "inspect.py", line 768, in getframeinfo lines, lnum = findsource(frame) File "inspect.py", line 437, in findsource if pat.match(lines[lnum]): break IndexError: list index out of range Unfortunately, your original traceback can not be constructed. ************* countries_table = Table("countries", metadata, Column("id", Integer, primary_key=True), Column("alpha2", String(2)), Column("alpha3", String(3)), Column("name", Unicode(100)), ) # association table with additional field countries_languages = Table("countries_languages", metadata, Column("country_id", Integer, ForeignKey('countries.id')), Column("language_id", Integer, ForeignKey('languages.id')), Column("is_primary", Boolean, default=False), # only one can be default at time ) languages_table = Table("languages", metadata, Column("id", Integer, primary_key=True), Column("alpha2", String(2)), Column("name", Unicode(100)), ) class BaseObject(object): def __init__(self): self._repr_ = [] def __repr__(self): from string import join str = ', '.join("'%s'" % (self.__dict__[v]) for v in self._repr_) return "<%s(%s)>" % (self.__class__, str) class NameObject(BaseObject): def __init__(self, name): self.name = name BaseObject.__init__(self) def __repr__(self): self._repr_ = ["name"] return BaseObject.__repr__(self) class Country(NameObject): def __init__(self, alpha2, alpha3, name): NameObject.__init__(self, name) self.alpha2 = alpha2 self.alpha3 = alpha3 class CountryLanguage(object): def __init__(self, is_primary = False): self.is_primary = is_primary class Language(NameObject): def __init__(self, alpha2, name): NameObject.__init__(self, name) self.alpha2 = alpha2 mapper(Country, countries_table, properties={ 'post_offices':relation(PostOffice, backref='country'), # one to many 'languages':relation(CountryLanguage, backref='country'), # many to many } ) mapper(CountryLanguage, countries_languages, properties={ 'language':relation(Language, backref="countries") } ) mapper(Language, languages_table) __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---