On 11/6/06, percious <[EMAIL PROTECTED]> wrote: > > I think I have reached the limit of what activemapper can do for me! > Consider the following example: > > class Alarm(ActiveMapper): > class mapping: > __table__ = "Alarm" > alarmID = column(Integer, primary_key=True) > variableAID = column(Integer, foreign_key = > 'Variable.variableID') > variableBID = column(Integer, foreign_key = > 'Variable.variableID') > variableA = one_to_one('CitectVariable', > colname='variableAID', backref='CitectDigitalAlarm')
Maybe it's just a typo for your example, but shouldn't that be 'Variable' instead of CitectVariable? > > class Variable(ActiveMapper): > class mapping: > __table__ = "Variable" > variableID = column(Integer, primary_key=True) > name = column(Unicode(256)) > > which will produce an error something like: > > class Variable(ActiveMapper): > File "build\bdist.win32\egg\sqlalchemy\ext\activemapper.py", line > 284, in __in > it__ > File "build\bdist.win32\egg\sqlalchemy\ext\activemapper.py", line > 196, in proc > ess_relationships > File "build\bdist.win32\egg\sqlalchemy\ext\activemapper.py", line > 181, in proc > ess_relationships > File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 607, in > add_proper > ties > File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 619, in > add_proper > ty > File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 671, in > _compile_p > roperty > File "build\bdist.win32\egg\sqlalchemy\orm\interfaces.py", line 39, > in init > File "build\bdist.win32\egg\sqlalchemy\orm\properties.py", line 190, > in do_ini > t > sqlalchemy.exceptions.ArgumentError: Error determining primary and/or > secondary > join for relationship 'variableA' between mappers 'Mapper|Alarm|Alarm' > and 'Mapp > er|Variable|Variable'. If the underlying error cannot be corrected, > you should > specify the 'primaryjoin' (and 'secondaryjoin', if there is an > association table > present) keyword arguments to the relation() function (or for > backrefs, by spec > ifying the backref using the backref() function with keyword arguments) > to expli > citly specify the join conditions. Nested error is "Cant determine > join between > 'Alarm' and 'Variable'; tables have more than one foreign key > constraint relati > onship between them. Please specify the 'onclause' of this join > explicitly." > > Am I missing something here? I know its not great database design, but > I have what I have so I am going to have to use it. Am I going to > have to dig in and put down some bruteforce SQLAlchemy tables? > > TIA > -chris > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---