Hello everyone, I've recently picked up SQLAlchemy for a project that I'm working on. I couldn't get a version newer than 0.3.10 (admin bureaucracy) and have to use this.
I create two tables like so run_table = sa.Table('runs',md, sa.Column('rid', sa.Integer, primary_key=True), sa.Column('cmdline', sa.String(250)), sa.Column('hostname', sa.String(20)), sa.Column('workdir', sa.String(250)), sa.Column('incremental', sa.Boolean), sa.Column('user', sa.String(20)), sa.Column('starttime', sa.TIMESTAMP), sa.Column('endtime', sa.TIMESTAMP), sa.Column('status',sa.String(20)), sa.Column('machinetype',sa.String(20)) ) run_table.create() stats_table = sa.Table('stats',md, sa.Column('sid',sa.Integer,primary_key=True), sa.Column('rid',sa.Integer,sa.ForeignKey('runs.rid')), sa.Column('stagename',sa.String(50)), sa.Column('description',sa.String(250)), sa.Column('starttime',sa.TIMESTAMP), sa.Column('endtime',sa.TIMESTAMP)) stats_table.create() Then I can actually use these tables. However, if I autoload them like so. run_table = sa.Table('runs', md, autoload=True) stats_table = sa.Table('stats', md, autoload=True) (md is the metadata) I get an error. The final assertion raised is like so sqlalchemy.exceptions.ArgumentError: Error determining primary and/or secondary join for relationship 'Run.stages (Stats)'. 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 'runs' and 'stats'" Am I doing something wrong or is there something else wrong here? If it's a bug that's been fixed in later versions, is there some kind of a workaround I could use? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---