Hello,

Thanks Mike for the comments. Before I answer the questions you asked, I want 
to note I found a workaround without making any changes to the database-- I 
just reversed the tables in the definition. At first I was using:

Survey.bossSpectrumHeaders = relationship(BOSSSpectrumHeader, backref="survey")

Changing this to the following worked:

BOSSSpectrumHeader.survey = relationship(Survey, backref="bossSpectrumHeaders")

I'm not really sure how to interpret that.


On Nov 3, 2011, at 6:25 PM, Michael Bayer wrote:

> two things I notice, first why using "extend_existing" - suggests theres more 
> going on here.

I'm not wholly sure why that is in place; my colleague wrote that part.

> Also are you certain the foreign key from boss.spectrum_header points to the 
> "platedb.schema" table and not another "schema" table elsewhere ?

Yes, that table name is unique across all schemas.

> Yet another thing, when you reflect the foreign key from spectrum_header, it 
> may not be coming back with "platedb" as the schema since you appear to be 
> referring to the remote table using the implicit search path.  SQLAlchemy may 
> not be matching that up like you expect.  There was an issue regarding this 
> which was fixed in 0.7.3, another user relying upon a long search path.

I do have a long search path.

> Do you get different results using 0.7.2 ?

No, the first thing I did when I got this error was upgrade to 0.7.3.

> can you try defining your foreign key constraints in PG consistently with 
> regards to how you're using schemas in your model ?  (i.e. either the FK is 
> to platedb.schema in PG, or remove the "platedb" schema from Survey).

I was reading the descriptions from PGAdmin3 - apparently they drop the schema 
in the display when the table is on the search path. There's nothing that I can 
do to further put the table in the schema, as it were.

I hope that knowing that reversing the order works helps to point to the 
problem...?

Cheers,
Demitri

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to