From 165609a190665f5453417c9c935a834714c7f5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20de=20Menten?= Date: Sat, 13 Feb 2010 22:53:39 +0000 Subject: - 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. --- lib/sqlalchemy/dialects/mysql/mysqldb.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/sqlalchemy/dialects/mysql/mysqldb.py') diff --git a/lib/sqlalchemy/dialects/mysql/mysqldb.py b/lib/sqlalchemy/dialects/mysql/mysqldb.py index c07ed8713..8cfd5930f 100644 --- a/lib/sqlalchemy/dialects/mysql/mysqldb.py +++ b/lib/sqlalchemy/dialects/mysql/mysqldb.py @@ -28,6 +28,7 @@ from sqlalchemy.dialects.mysql.base import (DECIMAL, MySQLDialect, MySQLExecutio from sqlalchemy.engine import base as engine_base, default from sqlalchemy.sql import operators as sql_operators from sqlalchemy import exc, log, schema, sql, types as sqltypes, util +from sqlalchemy import processors class MySQL_mysqldbExecutionContext(MySQLExecutionContext): @@ -51,12 +52,7 @@ class _DecimalType(_NumericType): def result_processor(self, dialect, coltype): if self.asdecimal: return None - def process(value): - if value is not None: - return float(value) - else: - return value - return process + return processors.to_float class _MySQLdbNumeric(_DecimalType, NUMERIC): -- cgit v1.2.1