Aculeus wrote:
>
> Sorry, I missed an example in my first message. The problem arises
> when you try to query across two databases:
>
> Session.query(MainUser).join((OtherUser, OtherUser.id == MainUser.id))
>
> Would normally products something like:
>
> SELECT * FROM MainUser INNER JOIN OtherUser ON OtherUser.id =
> MainUser.id
>
> When you really need the schema for the table that is in the other
> database:
>
>
> SELECT * FROM MainUser INNER JOIN other.OtherUser ON OtherUser.id =
> MainUser.id

If i understand correctly, you'd like a single Table object to
"dynamically" change its schema based on which engine its used with.  The
only way to achieve something like this is to make a copy of the table
against a different schema using table.tometadata(someothermetadata,
schema='someschema').

Tables do not assume to be "associated" with any one engine, so your
feature request of the Table automatically setting its "schema" to the
default schema of some particular engine is not possible.  If you'd like
to achieve this yourself, create a Table function of your own:

def Table(*args, **kw):
   kw['schema'] = "someschema"
   return sqlalchemy.schema.Table(*args, **kw)



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