From b880049b506b113ccce979ac0227b93cbd4ca66d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 19 Feb 2007 04:28:51 +0000 Subject: [PATCH] - oracle issues a log warning when a related table cant be reflected due to certain permission errors [ticket:363] --- CHANGES | 4 ++++ lib/sqlalchemy/databases/oracle.py | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 04ddf51992..2a76826961 100644 --- a/CHANGES +++ b/CHANGES @@ -52,6 +52,10 @@ - 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 diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py index 3f7cacd7b7..d7b78d3dd9 100644 --- a/lib/sqlalchemy/databases/oracle.py +++ b/lib/sqlalchemy/databases/oracle.py @@ -7,14 +7,9 @@ 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 @@ -234,7 +229,6 @@ class OracleDialect(ansisql.ANSIDialect): 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}) @@ -363,7 +357,7 @@ class OracleDialect(ansisql.ANSIDialect): 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]: @@ -392,6 +386,8 @@ class OracleDialect(ansisql.ANSIDialect): 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.""" -- 2.47.2