if you need SELECT <aliasname>.colname FROM schema.table AS <aliasname>, then you will have to translate more than just the FROM output, you need to translate the column clause elements also. so it might work better to actually create a real Alias to do the work (this is a rough idea...probably needs some tweaking): def __init__(self, **kwargs): self.tablealiases = {} def visit_table(self, table): if self.tablealiases.has_key(table): super(MSCompiler, self).visit_table(table) elif table.schema is not None: alias = table.alias() self.tablealiases[table] = alias alias.accept_visitor(self) self.froms[table] = self.froms[alias] def visit_column(self, column): super(MSCompiler, self).visit_column(column) if column.table is not None and self.tablealiases.has_key(column.table): self.strings[column]=self.strings[self.tablealiases[column.table]._get_col_by_original(column.original)] On Apr 1, 2006, at 9:24 AM, Rick Morrison wrote: I'm not sure I've got all of the cases covered, but at least one instance is this: |
- [Sqlalchemy-users] PATCH: Microsoft SQL Server engine Rick Morrison
- Re: [Sqlalchemy-users] PATCH: Microsoft SQL Server eng... Michael Bayer
- Re: [Sqlalchemy-users] PATCH: Microsoft SQL Server... Rick Morrison
- Re: [Sqlalchemy-users] PATCH: Microsoft SQL Se... Michael Bayer
- Re: [Sqlalchemy-users] PATCH: Microsoft SQ... Rick Morrison
- Re: [Sqlalchemy-users] PATCH: Microsoft SQL Se... Michael Bayer
- Re: [Sqlalchemy-users] PATCH: Microsoft SQ... Michael Twomey
- Re: [Sqlalchemy-users] PATCH: Microso... Michael Bayer
- Re: [Sqlalchemy-users] PATCH: Microsoft SQ... Rick Morrison
- Re: [Sqlalchemy-users] PATCH: Microso... Michael Bayer
- Re: [Sqlalchemy-users] PATCH: Mic... Rick Morrison
- Re: [Sqlalchemy-users] PATCH:... Michael Bayer
- Re: [Sqlalchemy-users] PATCH:... Rick Morrison