diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-08-31 23:55:42 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-08-31 23:55:42 +0000 |
| commit | 165065a948e961d9eb2b790023063c2c2f4882c3 (patch) | |
| tree | dbd1bd32d100c98b13ce273821e67368ae5e9eac /lib/sqlalchemy/databases | |
| parent | 9f23a5c3de9b98a3f74b11cc765b702ad741c4b5 (diff) | |
| download | sqlalchemy-165065a948e961d9eb2b790023063c2c2f4882c3.tar.gz | |
quoting more or less working with oracle
Diffstat (limited to 'lib/sqlalchemy/databases')
| -rw-r--r-- | lib/sqlalchemy/databases/oracle.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py index f5d7f52d5..5f574338b 100644 --- a/lib/sqlalchemy/databases/oracle.py +++ b/lib/sqlalchemy/databases/oracle.py @@ -186,8 +186,12 @@ class OracleDialect(ansisql.ANSIDialect): return bool( cursor.fetchone() is not None ) def reflecttable(self, connection, table): - # TODO: determine how oracle puts case sensitive names in data dictionary - c = connection.execute ("select distinct OWNER from ALL_TAB_COLUMNS where TABLE_NAME = :table_name", {'table_name':name.upper()}) + preparer = self.identifier_preparer + if not preparer.should_quote(table): + name = table.name.upper() + else: + name = table.name + c = connection.execute ("select distinct OWNER from ALL_TAB_COLUMNS where TABLE_NAME = :table_name", {'table_name':name}) rows = c.fetchall() if not rows : raise exceptions.NoSuchTableError(table.name) @@ -203,7 +207,7 @@ class OracleDialect(ansisql.ANSIDialect): else: raise exceptions.AssertionError("There are multiple tables with name %s in the schema, you must specifie owner"%table.name) - c = connection.execute ("select COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE, DATA_DEFAULT from ALL_TAB_COLUMNS where TABLE_NAME = :table_name and OWNER = :owner", {'table_name':table.name.upper(), 'owner':owner}) + c = connection.execute ("select COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE, DATA_DEFAULT from ALL_TAB_COLUMNS where TABLE_NAME = :table_name and OWNER = :owner", {'table_name':name, 'owner':owner}) while True: row = c.fetchone() @@ -234,8 +238,10 @@ class OracleDialect(ansisql.ANSIDialect): colargs = [] if default is not None: colargs.append(schema.PassiveDefault(sql.text(default))) - - name = name.lower() + + # if name comes back as all upper, assume its case folded + if (name.upper() == name): + name = name.lower() table.append_item (schema.Column(name, coltype, nullable=nullable, *colargs)) |
