> > the company I worked for has decided to change a RDBMS behind our ERP. > The side effect of this is that the columns will no longer be prefixed > with *t$* > but with* t_* instead. I do not want to change all the occurences of > column > names in my code. I should also mention, that I use only selects, and no > ORM. > > [...]
> > > But I'd probably not be using that approach either. Column objects > support a "key" field so that they need not be referenced in code in the > same way the relational database does; one of the primary purposes of > Column is to allow symbolic names to prevent the issue of needing to > "change all occurrences" of any schema-related name in code: > > my_table = Table('some_name', metadata, Column('t$somename', Integer, > key='somename')) > > Thanks for the pointers Mike. Just to clarify: The first argument to Column is the real name of the column in the database, while key is an alternative name under which I can access it, right? I have been unlucky with mssql, where the first part - the table definition and making queries worked, but not accessing data in RowProxy using the key. I guess there is a bug in dialects/mssql/base.py in MSSQLCompiler.visit_column: if result_map is not None: result_map[column.name.lower()] = \ - (column.name, (column, ), + (column.name, (column, column.name, column.key), column.type) return super(MSSQLCompiler, self).\ (also attaching...) Thanks again. -- Petr -- 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.
a.diff
Description: Binary data