Re: [sqlalchemy] Cross-schema foreign keys reflection

2013-08-14 Thread Jason


On Tuesday, August 13, 2013 7:43:54 PM UTC-4, Michael Bayer wrote:

 cross-schema reflection is supported on PG but has caveats, see 
 http://docs.sqlalchemy.org/en/rel_0_8/dialects/postgresql.html#remote-cross-schema-table-introspectionfor
  a discussion of recommended usage patterns.




Thanks for pointing out that page. I also needed to add the schema to the 
foreign key declarations.
 eg Column(Integer, ForeignKey('otherschema.othertable.id')) instead of 
Column(Integer, ForeignKey('othertable.id'))

-- Jason

-- 
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/groups/opt_out.




Re: [sqlalchemy] Cross-schema foreign keys reflection

2013-08-13 Thread Michael Bayer
cross-schema reflection is supported on PG but has caveats, see 
http://docs.sqlalchemy.org/en/rel_0_8/dialects/postgresql.html#remote-cross-schema-table-introspection
 for a discussion of recommended usage patterns.


On Aug 13, 2013, at 5:11 PM, Jason ja...@deadtreepages.com wrote:

 Hello,
 
 I am using reflection for my tables and I have the relationships defined 
 manually which are simply relationship(MyOtherModel). This worked fine when 
 all of the tables were in the same schema (this is Postgres). Now I have 
 moved MyOtherModel into a different schema and now I get there are no 
 foreign keys linking these tables error. Both models have their schema 
 specified in the __table_args__. If I specify the primaryjoin on the relation 
 all is well again.
 
 Is this a known behaviour when using foreign keys that cross schema 
 boundaries?
 
 I don't necessarily think this is a bug (which is why I didn't include a full 
 code example), but it is a behaviour I didn't expect.
 
 -- Jason
 
 -- 
 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/groups/opt_out.
  
  



signature.asc
Description: Message signed with OpenPGP using GPGMail