Did a quick experiment, and it appears that a ROLLBACK resets the search path.  
   Try calling dbapi_con.commit() in your event handler, that appears to cause 
the search path to remain persistent for the life of that connection.    

On May 22, 2012, at 4:31 PM, Demitri Muna wrote:

> Hi,
> 
> Progress! But still not working 100%. I have three assert statements: one 
> that tests a "to one" relationship across schemas, one that test a "to one" 
> relationship within the same scheme, and two that test a "many to many" 
> relationship across schemas (one assert for each direction).
> 
> When I set the search_path to what I'd like it to be (e.g. "things, people") 
> and use the "connect" event listener as detailed earlier in this thread, the 
> first two asserts (which broke before) now work. The first of the "many to 
> many" asserts works, but the reverse does not. However, the relationship 
> statements (in either direction) *do* seem to work. I can't explain that.
> 
> Going for it, I put the event listener into my large project and crossed my 
> fingers, but it doesn't work. I'm still running into these errors across 
> schemas:
> 
> ArgumentError: Could not determine join condition between parent/child tables 
> on relationship VisitSpectrum.observation.  Specify a 'primaryjoin' 
> expression.  If 'secondary' is present, 'secondaryjoin' is needed as well.
> 
> It works when I set the search path to "$user", i.e. no existing table, and 
> different things break depending on the order search path. As far as I can 
> tell the listener is setting the search path properly, but I have no idea how 
> persistent it is or if another connection is being made somehow where it's 
> not. So I'm getting frustrated.
> 
> Attached is my toy model where the relationship assertion breaks.
> 
> 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.
> 
> <schema_test.py>

-- 
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