Commits

Mike Bayer  committed ae383aa

- oracle issues a log warning when a related table cant be reflected due to certain
permission errors [ticket:363]

  • Participants
  • Parent commits 301fabb

Comments (0)

Files changed (2)

   - sequences on a non-pk column will properly fire off on INSERT
   - added PrefetchingResultProxy support to pre-fetch LOB columns when they are 
   known to be present, fixes [ticket:435]
+  - implemented reflection of tables based on synonyms, including across dblinks
+  [ticket:379]
+  - issues a log warning when a related table cant be reflected due to certain
+  permission errors [ticket:363]
 - mysql:
   - fix to reflection on older DB's that might return array() type for 
   "show variables like" statements

File lib/sqlalchemy/databases/oracle.py

 
 import sys, StringIO, string, re
 
-import sqlalchemy.util as util
-import sqlalchemy.sql as sql
-import sqlalchemy.engine as engine
+from sqlalchemy import util, sql, engine, schema, ansisql, exceptions, logging
 import sqlalchemy.engine.default as default
-import sqlalchemy.schema as schema
-import sqlalchemy.ansisql as ansisql
 import sqlalchemy.types as sqltypes
-import sqlalchemy.exceptions as exceptions
 
 try:
     import cx_Oracle
                         raise exceptions.AssertionError("There are multiple tables with name '%s' visible to the schema, you must specifiy owner" % name)
                     else:
                         return None
-        
     def _resolve_table_owner(self, connection, name, table, dblink=''):
         """locate the given table in the ALL_TAB_COLUMNS view, including searching for equivalent synonyms and dblinks"""
         c = connection.execute ("select distinct OWNER from ALL_TAB_COLUMNS%(dblink)s where TABLE_NAME = :table_name" % {'dblink':dblink}, {'table_name':name})
                    fks[cons_name] = fk
                 if remote_table is None:
                     # ticket 363
-                    raise exceptions.AssertionError("Got 'None' querying 'table_name' from all_cons_columns%(dblink)s - does the user have proper rights to the table?" % {'dblink':dblink})
+                    self.logger.warn("Got 'None' querying 'table_name' from all_cons_columns%(dblink)s - does the user have proper rights to the table?" % {'dblink':dblink})
                 refspec = ".".join([remote_table, remote_column])
                 schema.Table(remote_table, table.metadata, autoload=True, autoload_with=connection, owner=remote_owner)
                 if local_column not in fk[0]:
                     break
         return args
 
+OracleDialect.logger = logging.class_logger(OracleDialect)
+
 class OracleCompiler(ansisql.ANSICompiler):
     """oracle compiler modifies the lexical structure of Select statements to work under 
     non-ANSI configured Oracle databases, if the use_ansi flag is False."""