HI Michael ,
   Thanks for your reply,this is my table creation query without any
quoted variables

 CREATE TABLE AUTOLOAD_TEST
(
  ID INTEGER
, FIRST_NAME VARCHAR(20)
);

this is my connect_sqlalchemy.py script
++++++++++++++++++++++++++++++++++++++++++

from sqlalchemy import MetaData,create_engine,Table
engine = create_engine("oracle+cx_oracle://anoop:asdfgh@xe" )
meta = MetaData(engine)
tbl_autoload_test=Table('autoload_test', meta, autoload=True,
                    autoload_with=engine, schema=None)
print tbl_autoload_test.columns.keys()
++++++++++++++++++++++++++++++++++++++++++

When I run this script
(myenv)anoop@AGLAP:~/Example/sqlalchemy$ python connect_sqlalchemy.py
[u'id', u'first_name']  #Here I got column names in lower case

Current normalize_method  in (loc :/sqlalchemy/dialects/oracle/
base.py)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def normalize_name(self, name):
        if name is None:
            return None
        # Py2K
        if isinstance(name, str):
            name = name.decode(self.encoding)
        # end Py2K
        if name.upper() == name and \
              not
self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I modified the above method slightly my version of normalize_name
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 def normalize_name(self, name):
        if name is None:
            return None
        # Py2K
        if isinstance(name, str):
            name = name.decode(self.encoding)
        # end Py2K
        if name.upper() == name and \
              not self.identifier_preparer._requires_quotes(name): #
this is my change not converted into lower when calling
            return name.lower()
        else:
            return name

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


(myenv)anoop@AGLAP:~/Example/sqlalchemy$ python connect_sqlalchemy.py
#OUTPUT
===============================================================
[u'ID', u'FIRST_NAME'] # Here output is in Capital letters not
converted into lower case
================================================================

Did you got my point  ? In first the fourth checking (lc_value !=
value) in case _requires_quotes method (loc:sqlalchemy/sql/
compiler.py) is False because ('first_name'!='first_name' is the
checking) so here _requires_quotes will return False

But in second case (lc_value!=value) checking became True because now
the checking is 'first_name'!='FIRST_NAME' this  is True and
_requires_quotes will return True and we will get upper case column
names in upper case. I wondering why  "name" converted into lower when
calling _requires_quotes  because in  _requires_quotes again it is
converting into lower in statement " lc_value=value.lower() " ,I think
two times  lower conversion is not needed here,am I correct?.

thanks:
     Anoop

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