Changing the Relation declaration to 'project_studio' fixed this. Thanks for the advice.
On Oct 12, 11:58 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Oct 12, 2007, at 2:46 PM, jon wrote: > > > > > > > Hi, > > > I have the following set up in a Pylons application: > > > project_table = Table("PROJECT", metadata, autoload=True, > > autoload_with=config['pylons.g'].sa_engine) > > > studio_table = Table("STUDIO", metadata, autoload=True, > > autoload_with=config['pylons.g'].sa_engine) > > > class Project(object): > > pass > > > class Studio(object): > > pass > > > mapper(Project, project_table, properties = {'studio' : > > relation(Studio)}) > > > mapper(Studio, studio_table) > > > I'm using an Oracle database and the PROJECT table has a foreign key > > to STUDIO. But when I go to grab a Project object I get this error: > > > sqlalchemy.exceptions.ArgumentError: Error determining primary and/or > > secondary join for relationship 'Project.studio (Studio)'. 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 specifying the backref using the backref() function with > > keyword arguments) to explicitly specify the join conditions. Nested > > error is "Can't find any foreign key relationships between 'PROJECT' > > and 'STUDIO'" > > > I'm following the SQL Alchemy docs 0.4beta6 and the syntax seems to be > > correct. Do I need primaryjoin? Help a noobie out ;-) > > it means that PROJECT and STUDIO have no foreign key relationship > between them, so sqlalchemy cannot guess how to join those two tables. > > one thing I would do is, use "project" and "studio" as the table > names (i.e. no uppercase), this indicates non-case sensitive > reflection. if still the same error, either spell out the Column > objects in each Table explicitly (with the correct ForeignKey), or > use the "primaryjoin" argument on your relation(). > > hope this helps. > > - mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---