summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mssql/base.py
diff options
context:
space:
mode:
authorGaëtan de Menten <gdementen@gmail.com>2010-02-13 22:53:39 +0000
committerGaëtan de Menten <gdementen@gmail.com>2010-02-13 22:53:39 +0000
commit165609a190665f5453417c9c935a834714c7f5a5 (patch)
tree90d3d0da3f233cf6fc211f367eea0dba661b098e /lib/sqlalchemy/dialects/mssql/base.py
parentf2974ef3993e02646a2dfade5feb74afb78f370f (diff)
downloadsqlalchemy-165609a190665f5453417c9c935a834714c7f5a5.tar.gz
- Added an optional C extension to speed up the sql layer by
reimplementing the highest impact functions. The actual speedups will depend heavily on your DBAPI and the mix of datatypes used in your tables, and can vary from a 50% improvement to more than 200%. It also provides a modest (~20%) indirect improvement to ORM speed for large queries. Note that it is *not* built/installed by default. See README for installation instructions. - The most common result processors conversion function were moved to the new "processors" module. Dialect authors are encouraged to use those functions whenever they correspond to their needs instead of implementing custom ones.
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index 4e58d64b3..3f4e0b9f3 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -233,11 +233,10 @@ from sqlalchemy.sql import select, compiler, expression, \
functions as sql_functions, util as sql_util
from sqlalchemy.engine import default, base, reflection
from sqlalchemy import types as sqltypes
-from decimal import Decimal as _python_Decimal
+from sqlalchemy import processors
from sqlalchemy.types import INTEGER, BIGINT, SMALLINT, DECIMAL, NUMERIC, \
FLOAT, TIMESTAMP, DATETIME, DATE, BINARY,\
VARBINARY, BLOB
-
from sqlalchemy.dialects.mssql import information_schema as ischema
@@ -280,22 +279,12 @@ RESERVED_WORDS = set(
class _MSNumeric(sqltypes.Numeric):
def result_processor(self, dialect, coltype):
if self.asdecimal:
- def process(value):
- if value is not None:
- return _python_Decimal(str(value))
- else:
- return value
- return process
+ return processors.to_decimal_processor_factory(decimal.Decimal)
else:
#XXX: if the DBAPI returns a float (this is likely, given the
# processor when asdecimal is True), this should be a None
# processor instead.
- def process(value):
- if value is not None:
- return float(value)
- else:
- return value
- return process
+ return processors.to_float
def bind_processor(self, dialect):
def process(value):