Need a fully reproducing test case.   Here's my test against 0.6, with the 
MS-SQL dialect the schema names generate appropriately, including that the 
dialect goes through extra effort to work around MS-SQL's limitations regarding 
rendering of tables with schemas in column clauses:

from sqlalchemy import *

m = MetaData()
t1 = Table('t1', m,
    Column('ID', Integer),
    Column('col name with space', Integer),
    schema='schemaa'
)

t2 = Table('t2', m,
    Column('ID', Integer),
    Column('col name with space', Integer),
    schema='schemab'
)

j = t1.join(t2, t1.c.ID==t2.c.ID)

s = select([j])

from sqlalchemy.dialects import mssql
assert str(s.compile(dialect=mssql.dialect())) == \
    "SELECT t1_1.[ID], t1_1.[col name with space], t2_1.[ID], t2_1.[col name 
with space] \n"\
    "FROM schemaa.t1 AS t1_1 JOIN schemab.t2 AS t2_1 ON t1_1.[ID] = t2_1.[ID]"



On Jan 5, 2011, at 6:03 AM, Viktor Nagy wrote:

> hi,
> 
> I have an app that should run both on postgresql and mssql. (The client moves 
> its applications one-by-one to postgres.) Some parts of the app query several 
> databases, in Postgres I've solved this problem using schemas, but I have 
> problems with mssql.
> 
> I use Session.configure(binds=db_bindings) to get several schemas/databases 
> in the session.
> 
> finally I call:
> 
> session.query(metamob.Machines.id, metamob.Machines.name).join((power. 
> MachineSignalSources, 
> power.MachineSignalSources.machine_id==metamob.Machines.id 
> )).all()
> 
> in postgresql this generates a proper join between the two schemas, but in 
> mssql I get a simple one-db join (cbomasini is metamob.Machines, and 
> idautomatuilaje is power.MachineSignalSources:
> SELECT cbomasini.[ID] AS [cbomasini_ID], cbomasini.[Den umire] AS 
> [cbomasini_Denumire] \nFROM cbomasini JOIN idautomatutilaje ON idautom 
> atutilaje.[IDUtilaj] = cbomasini.[ID]
> 
> I'm using the pyodbc drivers for mssql. 
> 
> Viktor
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to