[sqlalchemy] Re: cross DB development, columns lower/upper case letters
are these column names using MixedCase ? otherwise you can probably access them in a case-insensitive fashion (oracle col names are usually case-insensitive) On Feb 12, 11:35 am, vkuznet [EMAIL PROTECTED] wrote: Hi, I'm trying to develop a cross-DB application which works with ORACLE and MySQL back-ends. Both DBs has the same schema, but of course there is a caveat. ORACLE has Tables and Columns in upper case and MySQL does not. That leads to the following problem. When I construct select(table.c.column) I face out with problem that I need to specify lower case for column in MySQL and upper case letters for ORACLE. With table names it's easy I can use table aliases. But how to avoid problem with columns names. Thanks, Valentin. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: cross DB development, columns lower/upper case letters
On Feb 12, 3:45 pm, vkuznet [EMAIL PROTECTED] wrote: No, here is real problem: schema had the following: create table Foo (int id); in MySQL it creates table 'Foo' and column 'id'. in ORACLE it creates table 'FOO' and column 'ID' That's create a problem in sqlalchemy, when I access columns. I can make an alias for table names, e.g. tf, but then for MySQL I end up using tf.c.id and for ORACLE I need tf.c.ID. and I cannot use tf.c.ID in MySQL (or tf.c.id in ORACLE) since such columns doesn't exists in sqlalchemy table object. look at the echoed SQL. is SQLAlchemy putting quotes around the identifier names ? if not, then you are accessing in a case- insensitive fashion - the id/ID case doesnt matter. put the case_sensitive=False flag on your MetaData and see if that works. id also advise not using any MixedCase identifier names (which Foo is). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---