So, is there any chance that relations across multiple _logical_
databases on a _single_ physical server will be supported by
SQLAlchemy in the future?

As I mentioned before, this could work (at least for MSSQL)
if we only had a databasename="foo" on Table(). I am not
really sure how much work it would be, but it _sounds_ easy. :)

Thanks.

- Luke

On Wed, Oct 14, 2009 at 3:01 PM, Luke Arno <luke.a...@gmail.com> wrote:

> Thanks, Simon. Good suggestion, but these are databases and not
> schema within a database. If I use the schema="MyDatabase." (
> notice the ".") and quote_schema=False, the table names come out
> like I want, but look at what happens to the label here:
>
> SELECT [LeftTable_1].description AS [MyDatabase._LeftTab_1]
> FROM MyDatabase..[LeftTable] AS [LeftTable_1]
> WHERE [LeftTable_1].id = %(param_1)s
>
> That is really abusing the schema feature, so this is not a bug... I
> just wish there were a databasename="Foo" option for Table() so I
> could use these ugly databases the way they are. :(
>
>
> On Wed, Oct 14, 2009 at 11:51 AM, King Simon-NFHD78 <
> simon.k...@motorola.com> wrote:
>
>>
>> > -----Original Message-----
>> > From: sqlalchemy@googlegroups.com
>> > [mailto:sqlalch...@googlegroups.com] On Behalf Of Luke Arno
>> > Sent: 14 October 2009 16:41
>> > To: sqlalchemy@googlegroups.com
>> > Subject: [sqlalchemy] Re: ORM Many to Many Across Two Databases
>> >
>> > It looks like if I put the relation on the obj mapped to the DB where
>> > the association table is _not_, it works in one direction.
>> > (So, in the
>> > example Right.lefts can work but Left.rights cannot.) When trying to
>> > use Left.rights, it looks for the table in the wrong database.
>> >
>> > It appears that it would be fine if I could just get the
>> > table names all
>> > qualified with database name in the issued SQL. Is there a way to
>> > make that happen, by any chance?
>> >
>>
>> You can do this by using a single engine and metadata, and passing a
>> 'schema' parameter when defining your tables:
>>
>> http://www.sqlalchemy.org/docs/05/metadata.html#specifying-the-schema-na
>> me
>>
>> Hope that helps,
>>
>> Simon
>>
>> >>
>>
>

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