summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-01-11 01:28:43 +0000
committerJason Kirtland <jek@discorporate.us>2008-01-11 01:28:43 +0000
commit8dd825b413276025b0f27d2ed7e5b93ba81a5b9c (patch)
tree4a13aec5f61d1a934a3b4a527e9bdaf7f5cfc9ce /lib/sqlalchemy/databases
parent3e9df22546cb4c7af0ece290f4f57a377516f142 (diff)
downloadsqlalchemy-8dd825b413276025b0f27d2ed7e5b93ba81a5b9c.tar.gz
- Warnings are now issued as SAWarning instead of RuntimeWarning; util.warn() wraps this up.
- SADeprecationWarning has moved to exceptions. An alias remains in logging until 0.5.
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r--lib/sqlalchemy/databases/firebird.py4
-rw-r--r--lib/sqlalchemy/databases/informix.py5
-rw-r--r--lib/sqlalchemy/databases/maxdb.py7
-rw-r--r--lib/sqlalchemy/databases/mssql.py5
-rw-r--r--lib/sqlalchemy/databases/mysql.py21
-rw-r--r--lib/sqlalchemy/databases/oracle.py12
-rw-r--r--lib/sqlalchemy/databases/postgres.py5
-rw-r--r--lib/sqlalchemy/databases/sqlite.py12
-rw-r--r--lib/sqlalchemy/databases/sybase.py5
9 files changed, 40 insertions, 36 deletions
diff --git a/lib/sqlalchemy/databases/firebird.py b/lib/sqlalchemy/databases/firebird.py
index e16593eb8..c83a44e01 100644
--- a/lib/sqlalchemy/databases/firebird.py
+++ b/lib/sqlalchemy/databases/firebird.py
@@ -88,7 +88,6 @@ connections are active, the following setting may alleviate the problem::
import datetime
-import warnings
from sqlalchemy import exceptions, schema, types as sqltypes, sql, util
from sqlalchemy.engine import base, default
@@ -461,7 +460,8 @@ class FBDialect(default.DefaultDialect):
# get the data types and lengths
coltype = ischema_names.get(row['ftype'].rstrip())
if coltype is None:
- warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (str(row['ftype']), name)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (str(row['ftype']), name))
coltype = sqltypes.NULLTYPE
else:
coltype = coltype(row)
diff --git a/lib/sqlalchemy/databases/informix.py b/lib/sqlalchemy/databases/informix.py
index eb0793243..03fbcd67e 100644
--- a/lib/sqlalchemy/databases/informix.py
+++ b/lib/sqlalchemy/databases/informix.py
@@ -6,7 +6,7 @@
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import datetime, warnings
+import datetime
from sqlalchemy import sql, schema, exceptions, pool
from sqlalchemy.sql import compiler
@@ -311,7 +311,8 @@ class InfoDialect(default.DefaultDialect):
try:
coltype = ischema_names[coltype]
except KeyError:
- warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (coltype, name)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (coltype, name))
coltype = sqltypes.NULLTYPE
colargs = []
diff --git a/lib/sqlalchemy/databases/maxdb.py b/lib/sqlalchemy/databases/maxdb.py
index 4aa59bc28..23ff1f4a0 100644
--- a/lib/sqlalchemy/databases/maxdb.py
+++ b/lib/sqlalchemy/databases/maxdb.py
@@ -56,7 +56,7 @@ integration- email the devel list if you're interested in working on
this.
"""
-import datetime, itertools, re, warnings
+import datetime, itertools, re
from sqlalchemy import exceptions, schema, sql, util
from sqlalchemy.sql import operators as sql_operators, expression as sql_expr
@@ -632,9 +632,8 @@ class MaxDBDialect(default.DefaultDialect):
type_cls = ischema_names[col_type.lower()]
type_instance = type_cls(*type_args, **type_kw)
except KeyError:
- warnings.warn(RuntimeWarning(
- "Did not recognize type '%s' of column '%s'" %
- (col_type, name)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (col_type, name))
type_instance = sqltypes.NullType
col_kw = {'autoincrement': False}
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 572139d48..2ec645eea 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -37,7 +37,7 @@ Known issues / TODO:
"""
-import datetime, random, warnings, re, sys, operator
+import datetime, operator, random, re, sys
from sqlalchemy import sql, schema, exceptions, util
from sqlalchemy.sql import compiler, expression, operators as sqlops
@@ -585,7 +585,8 @@ class MSSQLDialect(default.DefaultDialect):
coltype = MSText()
else:
if coltype is None:
- warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (type, name)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (type, name))
coltype = sqltypes.NULLTYPE
elif coltype in (MSNVarchar, AdoMSNVarchar) and charlen == -1:
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index 17defbb70..e7e3ec069 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -143,7 +143,7 @@ Notes page on the wiki at http://www.sqlalchemy.org is a good resource for
timely information affecting MySQL in SQLAlchemy.
"""
-import re, datetime, inspect, warnings, sys
+import datetime, inspect, re, sys
from array import array as _array
from sqlalchemy import exceptions, logging, schema, sql, util
@@ -1695,10 +1695,10 @@ class MySQLDialect(default.DefaultDialect):
if 'character_set' in opts:
return opts['character_set']
else:
- warnings.warn(RuntimeWarning(
+ util.warn(
"Could not detect the connection character set with this "
"combination of MySQL server and MySQL-python. "
- "MySQL-python >= 1.2.2 is recommended. Assuming latin1."))
+ "MySQL-python >= 1.2.2 is recommended. Assuming latin1.")
return 'latin1'
def _detect_casing(self, connection, charset=None):
@@ -2068,9 +2068,7 @@ class MySQLSchemaReflector(object):
else:
type_, spec = self.parse_constraints(line)
if type_ is None:
- warnings.warn(
- RuntimeWarning("Unknown schema content: %s" %
- repr(line)))
+ util.warn("Unknown schema content: %r" % line)
elif type_ == 'key':
keys.append(spec)
elif type_ == 'constraint':
@@ -2098,12 +2096,10 @@ class MySQLSchemaReflector(object):
def _add_column(self, table, line, charset, only=None):
spec = self.parse_column(line)
if not spec:
- warnings.warn(RuntimeWarning(
- "Unknown column definition %s" % line))
+ util.warn("Unknown column definition %r" % line)
return
if not spec['full']:
- warnings.warn(RuntimeWarning(
- "Incomplete reflection of column definition %s" % line))
+ util.warn("Incomplete reflection of column definition %r" % line)
name, type_, args, notnull = \
spec['name'], spec['coltype'], spec['arg'], spec['notnull']
@@ -2121,9 +2117,8 @@ class MySQLSchemaReflector(object):
try:
col_type = ischema_names[type_]
except KeyError:
- warnings.warn(RuntimeWarning(
- "Did not recognize type '%s' of column '%s'" %
- (type_, name)))
+ util.warn("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/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py
index 394aba178..c7ab13441 100644
--- a/lib/sqlalchemy/databases/oracle.py
+++ b/lib/sqlalchemy/databases/oracle.py
@@ -5,7 +5,7 @@
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import re, warnings, random
+import datetime, random, re
from sqlalchemy import util, sql, schema, exceptions, logging
from sqlalchemy.engine import default, base
@@ -13,8 +13,6 @@ from sqlalchemy.sql import compiler, visitors
from sqlalchemy.sql import operators as sql_operators
from sqlalchemy import types as sqltypes
-import datetime
-
class OracleNumeric(sqltypes.Numeric):
def get_col_spec(self):
@@ -501,7 +499,8 @@ class OracleDialect(default.DefaultDialect):
try:
coltype = ischema_names[coltype]
except KeyError:
- warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (coltype, colname)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (coltype, colname))
coltype = sqltypes.NULLTYPE
colargs = []
@@ -551,7 +550,10 @@ class OracleDialect(default.DefaultDialect):
fks[cons_name] = fk
if remote_table is None:
# ticket 363
- warnings.warn("Got 'None' querying 'table_name' from all_cons_columns%(dblink)s - does the user have proper rights to the table?" % {'dblink':dblink})
+ util.warn(
+ ("Got 'None' querying 'table_name' from "
+ "all_cons_columns%(dblink)s - does the user have "
+ "proper rights to the table?") % {'dblink':dblink})
continue
refspec = ".".join([remote_table, remote_column])
schema.Table(remote_table, table.metadata, autoload=True, autoload_with=connection, owner=remote_owner)
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 623726980..19db8b6b7 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -19,7 +19,7 @@ parameter when creating the queries::
postgres_returning=[empl.c.id, empl.c.salary]).execute().fetchall()
"""
-import re, random, warnings, string
+import random, re, string
from sqlalchemy import sql, schema, exceptions, util
from sqlalchemy.engine import base, default
@@ -511,7 +511,8 @@ class PGDialect(default.DefaultDialect):
if is_array:
coltype = PGArray(coltype)
else:
- warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (attype, name)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (attype, name))
coltype = sqltypes.NULLTYPE
colargs= []
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py
index 36e05a067..4ce898727 100644
--- a/lib/sqlalchemy/databases/sqlite.py
+++ b/lib/sqlalchemy/databases/sqlite.py
@@ -5,12 +5,11 @@
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import re
+import datetime, re, time
from sqlalchemy import schema, exceptions, pool, PassiveDefault
from sqlalchemy.engine import default
import sqlalchemy.types as sqltypes
-import datetime,time, warnings
import sqlalchemy.util as util
from sqlalchemy.sql import compiler
@@ -202,7 +201,11 @@ class SQLiteDialect(default.DefaultDialect):
if self.dbapi is not None:
sqlite_ver = self.dbapi.version_info
if sqlite_ver < (2,1,'3'):
- warnings.warn(RuntimeWarning("The installed version of pysqlite2 (%s) is out-dated, and will cause errors in some cases. Version 2.1.3 or greater is recommended." % '.'.join([str(subver) for subver in sqlite_ver])))
+ util.warn(
+ ("The installed version of pysqlite2 (%s) is out-dated "
+ "and will cause errors in some cases. Version 2.1.3 "
+ "or greater is recommended.") %
+ '.'.join([str(subver) for subver in sqlite_ver]))
self.supports_cast = (self.dbapi is None or vers(self.dbapi.sqlite_version) >= vers("3.2.3"))
def dbapi(cls):
@@ -281,7 +284,8 @@ class SQLiteDialect(default.DefaultDialect):
try:
coltype = ischema_names[coltype]
except KeyError:
- warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (coltype, name)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (coltype, name))
coltype = sqltypes.NullType
if args is not None:
diff --git a/lib/sqlalchemy/databases/sybase.py b/lib/sqlalchemy/databases/sybase.py
index f7c3d8a0f..bf2b6b7d6 100644
--- a/lib/sqlalchemy/databases/sybase.py
+++ b/lib/sqlalchemy/databases/sybase.py
@@ -22,7 +22,7 @@ Known issues / TODO:
* Tested on 'Adaptive Server Anywhere 9' (version 9.0.1.1751)
"""
-import datetime, random, warnings, operator
+import datetime, operator, random
from sqlalchemy import util, sql, schema, exceptions
from sqlalchemy.sql import compiler, expression
@@ -593,7 +593,8 @@ class SybaseSQLDialect(default.DefaultDialect):
coltype = SybaseText()
else:
if coltype is None:
- warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (type, name)))
+ util.warn("Did not recognize type '%s' of column '%s'" %
+ (type, name))
coltype = sqltypes.NULLTYPE
coltype = coltype(*args)
colargs= []