SqlSoup documentation seems incorrect for mysql joins

Issue #1324 resolved
Former user created an issue

The SqlSoup documentation states:

""" If you’re unfortunate enough to be using MySQL with the default MyISAM storage engine, you’ll have to specify the join condition manually, since MyISAM does not store foreign keys. Here’s the same join again, with the join condition explicitly specified:

db.join(db.users, db.loans, db.users.name==db.loans.user_name, isouter=True) <class 'sqlalchemy.ext.sqlsoup.MappedJoin'> """

But, I found that I actually had to specify:

db.join(results, jobs, results.c.jobs_id==jobs.c.jobs_id) <class 'sqlalchemy.ext.sqlsoup.MappedJoin'>

When using the documented syntax I got:

db.join(results, jobs, results.jobs_id==jobs.jobs_id) ... AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object has an attribute '_sa_instance_state'

This is with SQLAlchemy 0.5.2. The exception source is line 136 of sqlalchemy.orm.attributes.

Mike

Comments (6)

  1. Mike Bayer repo owner

    Not sure above what results and jobs are, this would suggest that they are Table objects. In the referenced documentation, db.users and db.results are mapped classes.

  2. Log in to comment