On Thu, Feb 19, 2015 at 02:45:43PM +0100, Julien Cigar wrote:
> Hello,
> 
> I'm using SQLAlchemy 0.9.8 with PostgreSQL and the reflection feature of
> SQLAlchemy.
> 
> I have the following tables (only relevant parts are show):
> https://gist.github.com/silenius/390bb9937490730741f2
> 
> and the "problematic" mapper is the one of my association object:
> https://gist.github.com/silenius/1559a7db65ed30a1b079
> 
> SQLAlchemy complains with the following error:
> "sqlalchemy.exc.InvalidRequestError: One or more mappers failed to
> initialize - can't proceed with initialization of other mappers.
> Original exception was: Could not locate any simple equality expressions
> involving locally mapped foreign key columns for primary join condition
> 'pool_invite_result.pool_invite_pool_id = pool_invite.pool_id AND
> pool_invite.pool_id = pool.id' on relationship PoolAccountResult.pool.
> Ensure that referencing columns are associated with a ForeignKey or
> ForeignKeyConstraint, or are annotated in the join condition with the
> foreign() annotation. To allow comparison operators other than '==', the
> relationship can be marked as viewonly=True."
> 
> The problem is that in the PoolAccountResult mapper I want a
> relationship to the Pool but the link is made through an intermediate
> table (pool_invite) ..
> 
> Any idea how to handle this with SQLAlchemy ?
> 
> Thanks :)
> 
> Julien

... and I'm answering to myself: it seems to work with
https://gist.github.com/silenius/e7e59c96a7277fb5879f 

does it sound right ?

> 
> -- 
> Julien Cigar
> Belgian Biodiversity Platform (http://www.biodiversity.be)
> PGP fingerprint: EEF9 F697 4B68 D275 7B11  6A25 B2BB 3710 A204 23C0
> No trees were killed in the creation of this message.
> However, many electrons were terribly inconvenienced.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.



-- 
Julien Cigar
Belgian Biodiversity Platform (http://www.biodiversity.be)
PGP fingerprint: EEF9 F697 4B68 D275 7B11  6A25 B2BB 3710 A204 23C0
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Attachment: pgpDJ4I7_2j3x.pgp
Description: PGP signature

Reply via email to