summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
diff options
context:
space:
mode:
authorndparker <ndparker@users.noreply.github.com>2014-09-24 00:13:40 +0200
committerndparker <ndparker@users.noreply.github.com>2014-10-05 00:54:09 +0200
commit00018f0748a2eac323248c5d80c28a127907344a (patch)
tree1b0ce2f321f7951b1992224526fe08f7b60e18b2 /lib/sqlalchemy/dialects
parent360477cc3af826b5056039b9a19ec3ecb2b94ede (diff)
downloadsqlalchemy-pr/141.tar.gz
specialize schema reflection warningspr/141
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r--lib/sqlalchemy/dialects/firebird/base.py5
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py4
-rw-r--r--lib/sqlalchemy/dialects/mysql/base.py14
-rw-r--r--lib/sqlalchemy/dialects/oracle/base.py7
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py14
-rw-r--r--lib/sqlalchemy/dialects/sqlite/base.py4
-rw-r--r--lib/sqlalchemy/dialects/sybase/base.py5
7 files changed, 32 insertions, 21 deletions
diff --git a/lib/sqlalchemy/dialects/firebird/base.py b/lib/sqlalchemy/dialects/firebird/base.py
index 36229a105..c055bb2bb 100644
--- a/lib/sqlalchemy/dialects/firebird/base.py
+++ b/lib/sqlalchemy/dialects/firebird/base.py
@@ -609,8 +609,9 @@ class FBDialect(default.DefaultDialect):
colspec = row['ftype'].rstrip()
coltype = self.ischema_names.get(colspec)
if coltype is None:
- util.warn("Did not recognize type '%s' of column '%s'" %
- (colspec, name))
+ util.warn(exc.SAUnknownTypeReflectionWarning(
+ "Did not recognize type '%s' of column '%s'" %
+ (colspec, name)))
coltype = sqltypes.NULLTYPE
elif issubclass(coltype, Integer) and row['fprec'] != 0:
coltype = NUMERIC(
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index ba3050ae5..faa342659 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -1600,9 +1600,9 @@ class MSDialect(default.DefaultDialect):
kwargs.pop('length')
if coltype is None:
- util.warn(
+ util.warn(exc.SAUnknownTypeReflectionWarning(
"Did not recognize type '%s' of column '%s'" %
- (type, name))
+ (type, name)))
coltype = sqltypes.NULLTYPE
else:
if issubclass(coltype, sqltypes.Numeric) and \
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py
index 7ccd59abb..365155fe1 100644
--- a/lib/sqlalchemy/dialects/mysql/base.py
+++ b/lib/sqlalchemy/dialects/mysql/base.py
@@ -2904,10 +2904,14 @@ class MySQLTableDefinitionParser(object):
spec = m.groupdict()
spec['full'] = False
if not spec:
- util.warn("Unknown column definition %r" % line)
+ util.warn(exc.SAUnparsableTypeReflectionWarning(
+ "Unknown column definition %r" % line
+ ))
return
if not spec['full']:
- util.warn("Incomplete reflection of column definition %r" % line)
+ util.warn(exc.SAIncompleteTypeReflectionWarning(
+ "Incomplete reflection of column definition %r" % line
+ ))
name, type_, args, notnull = \
spec['name'], spec['coltype'], spec['arg'], spec['notnull']
@@ -2915,8 +2919,10 @@ class MySQLTableDefinitionParser(object):
try:
col_type = self.dialect.ischema_names[type_]
except KeyError:
- util.warn("Did not recognize type '%s' of column '%s'" %
- (type_, name))
+ util.warn(exc.SAUnknownTypeReflectionWarning(
+ "Did not recognize type '%s' of column '%s'" %
+ (type_, name)
+ ))
col_type = sqltypes.NullType
# Column type positional arguments eg. varchar(32)
diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py
index 837a498fb..d07bd572b 100644
--- a/lib/sqlalchemy/dialects/oracle/base.py
+++ b/lib/sqlalchemy/dialects/oracle/base.py
@@ -232,7 +232,7 @@ in conjunction with the :class:`.Table` construct:
import re
-from sqlalchemy import util, sql
+from sqlalchemy import util, sql, exc
from sqlalchemy.engine import default, base, reflection
from sqlalchemy.sql import compiler, visitors, expression
from sqlalchemy.sql import (operators as sql_operators,
@@ -1137,8 +1137,9 @@ class OracleDialect(default.DefaultDialect):
try:
coltype = self.ischema_names[coltype]
except KeyError:
- util.warn("Did not recognize type '%s' of column '%s'" %
- (coltype, colname))
+ util.warn(exc.SAUnknownTypeReflectionWarning(
+ "Did not recognize type '%s' of column '%s'" %
+ (coltype, colname)))
coltype = sqltypes.NULLTYPE
cdict = {
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index b9a0d461b..fe256a249 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -2282,8 +2282,10 @@ class PGDialect(default.DefaultDialect):
if is_array:
coltype = ARRAY(coltype)
else:
- util.warn("Did not recognize type '%s' of column '%s'" %
- (attype, name))
+ util.warn(exc.SAUnknownTypeReflectionWarning(
+ "Did not recognize type '%s' of column '%s'" %
+ (attype, name)
+ ))
coltype = sqltypes.NULLTYPE
# adjust the default value
autoincrement = False
@@ -2505,17 +2507,17 @@ class PGDialect(default.DefaultDialect):
if expr:
if idx_name != sv_idx_name:
- util.warn(
+ util.warn(exc.SAUnsupportedIndexReflectionWarning(
"Skipped unsupported reflection of "
"expression-based index %s"
- % idx_name)
+ % idx_name))
sv_idx_name = idx_name
continue
if prd and not idx_name == sv_idx_name:
- util.warn(
+ util.warn(exc.SAIncompleteIndexReflectionWarning(
"Predicate of partial index %s ignored during reflection"
- % idx_name)
+ % idx_name))
sv_idx_name = idx_name
index = indexes[idx_name]
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py
index 817834b7d..1c6fa145a 100644
--- a/lib/sqlalchemy/dialects/sqlite/base.py
+++ b/lib/sqlalchemy/dialects/sqlite/base.py
@@ -987,10 +987,10 @@ class SQLiteDialect(default.DefaultDialect):
try:
coltype = coltype(*[int(a) for a in args])
except TypeError:
- util.warn(
+ util.warn(exc.SAIncompleteTypeReflectionWarning(
"Could not instantiate type %s with "
"reflected arguments %s; using no arguments." %
- (coltype, args))
+ (coltype, args)))
coltype = coltype()
else:
coltype = coltype()
diff --git a/lib/sqlalchemy/dialects/sybase/base.py b/lib/sqlalchemy/dialects/sybase/base.py
index f65a76a27..97fd0469a 100644
--- a/lib/sqlalchemy/dialects/sybase/base.py
+++ b/lib/sqlalchemy/dialects/sybase/base.py
@@ -550,8 +550,9 @@ class SybaseDialect(default.DefaultDialect):
# if is_array:
# coltype = ARRAY(coltype)
else:
- util.warn("Did not recognize type '%s' of column '%s'" %
- (type_, name))
+ util.warn(exc.SAUnknownTypeReflectionWarning(
+ "Did not recognize type '%s' of column '%s'" %
+ (type_, name)))
coltype = sqltypes.NULLTYPE
if default: