NullType is substituted instead, warning is raised.
- consolidation of imports in some db modules
- added "explcit" create/drop/execute support for sequences
(i.e. you can pass a "connectable" to each of those methods
on Sequence)
+ - standardized the behavior for table reflection where types can't be located;
+ NullType is substituted instead, warning is raised.
- extensions
- proxyengine is temporarily removed, pending an actually working
replacement.
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import sys, StringIO, string, types
+import sys, StringIO, string, types, warnings
-from sqlalchemy import util
+from sqlalchemy import util, sql, schema, ansisql, exceptions
import sqlalchemy.engine.default as default
-import sqlalchemy.sql as sql
-import sqlalchemy.schema as schema
-import sqlalchemy.ansisql as ansisql
import sqlalchemy.types as sqltypes
-import sqlalchemy.exceptions as exceptions
_initialized_kb = False
kw = {}
# get the data types and lengths
- args.append(column_func[row['FTYPE']](row))
+ coltype = column_func.get(row['FTYPE'], None)
+ if coltype is None:
+ warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (str(row['FTYPE']), name)))
+ coltype = sqltypes.NULLTYPE
+ else:
+ coltype = coltype(row)
+ args.append(coltype)
# is it a primary key?
kw['primary_key'] = name in pkfields
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import sys, StringIO, string , random
+import sys, StringIO, string , random, warnings
import datetime
from decimal import Decimal
-import sqlalchemy.util as util
-import sqlalchemy.sql as sql
-import sqlalchemy.engine as engine
+from sqlalchemy import util, sql, engine, schema, ansisql, exceptions, pool
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
-import sqlalchemy.pool as pool
# for offset
scale = 0
coltype = InfoNumeric(precision, scale)
else:
- coltype = ischema_names.get(coltype)
+ try:
+ coltype = ischema_names[coltype]
+ except KeyError:
+ warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (coltype, name)))
+ coltype = sqltypes.NULLTYPE
colargs = []
if default is not None:
"""
-import sys, StringIO, string, types, re, datetime, random
+import sys, StringIO, string, types, re, datetime, random, warnings
-import sqlalchemy.sql as sql
-import sqlalchemy.engine as engine
-import sqlalchemy.engine.default as default
-import sqlalchemy.schema as schema
-import sqlalchemy.ansisql as ansisql
+from sqlalchemy import sql, engine, schema, ansisql, exceptions
import sqlalchemy.types as sqltypes
-import sqlalchemy.exceptions as exceptions
-
+from sqlalchemy.engine import default
class MSNumeric(sqltypes.Numeric):
def convert_result_value(self, value, dialect):
for a in (charlen, numericprec, numericscale):
if a is not None:
args.append(a)
- coltype = self.ischema_names[type]
+ coltype = self.ischema_names.get(type, None)
if coltype == MSString and charlen == -1:
coltype = MSText()
else:
- if coltype == MSNVarchar and charlen == -1:
+ if coltype is None:
+ warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (type, name)))
+ coltype = sqltypes.NULLTYPE
+
+ elif coltype == MSNVarchar and charlen == -1:
charlen = None
coltype = coltype(*args)
colargs= []
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import sys, StringIO, string, types, re, datetime, inspect
+import sys, StringIO, string, types, re, datetime, inspect, warnings
from sqlalchemy import sql,engine,schema,ansisql
from sqlalchemy.engine import default
extra_2 = match.group(4)
#print "coltype: " + repr(col_type) + " args: " + repr(args) + "extras:" + repr(extra_1) + ' ' + repr(extra_2)
- coltype = ischema_names.get(col_type, MSString)
+ try:
+ coltype = ischema_names[col_type]
+ except KeyError:
+ warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (col_type, name)))
+ coltype = sqltypes.NULLTYPE
kw = {}
if extra_1 is not None:
try:
coltype = ischema_names[coltype]
except KeyError:
- raise exceptions.AssertionError("Can't get coltype for type '%s' on colname '%s'" % (coltype, colname))
+ warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (coltype, colname)))
+ coltype = sqltypes.NULLTYPE
colargs = []
if default is not None:
args = ''
#print "coltype: " + repr(coltype) + " args: " + repr(args)
- coltype = pragma_names.get(coltype, SLString)
+ try:
+ coltype = pragma_names[coltype]
+ except KeyError:
+ warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (coltype, name)))
+ coltype = sqltypes.NULLTYPE
+
if args is not None:
args = re.findall(r'(\d+)', args)
#print "args! " +repr(args)
return typeobj
return typeobj.adapt(impltype)
-class NullTypeEngine(TypeEngine):
+class NullType(TypeEngine):
def get_col_spec(self):
raise NotImplementedError()
def convert_result_value(self, value, dialect):
return value
+NullTypeEngine = NullType
class String(TypeEngine):
def __init__(self, length=None, convert_unicode=False):
class BLOB(Binary): pass
class BOOLEAN(Boolean): pass
-NULLTYPE = NullTypeEngine()
+NULLTYPE = NullType()