summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-11-24 00:55:39 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-11-24 00:55:39 +0000
commit3f93103a5ef9128b7b300c51d41dea43dd843834 (patch)
tree7c21cb4a15c91c9d7ae38425da69c96d0ed26caf /lib/sqlalchemy/engine
parent238dc916fa9fca6c79046dea004d108df685e29e (diff)
downloadsqlalchemy-3f93103a5ef9128b7b300c51d41dea43dd843834.tar.gz
- all kinds of cleanup, tiny-to-slightly-significant speed improvements
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/base.py28
-rw-r--r--lib/sqlalchemy/engine/default.py9
2 files changed, 14 insertions, 23 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 6af0ce0d3..9c7e70ba9 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -87,6 +87,17 @@ class Dialect(object):
supports_pk_autoincrement
Indicates if the dialect should allow the database to passively assign
a primary key column value.
+
+ dbapi_type_map
+ A mapping of DB-API type objects present in this Dialect's
+ DB-API implmentation mapped to TypeEngine implementations used
+ by the dialect.
+
+ This is used to apply types to result sets based on the DB-API
+ types present in cursor.description; it only takes effect for
+ result sets against textual statements where no explicit
+ typemap was present.
+
"""
def create_connect_args(self, url):
@@ -99,21 +110,6 @@ class Dialect(object):
raise NotImplementedError()
- def dbapi_type_map(self):
- """Returns a DB-API to sqlalchemy.types mapping.
-
- A mapping of DB-API type objects present in this Dialect's
- DB-API implmentation mapped to TypeEngine implementations used
- by the dialect.
-
- This is used to apply types to result sets based on the DB-API
- types present in cursor.description; it only takes effect for
- result sets against textual statements where no explicit
- typemap was present. Constructed SQL statements always have
- type information explicitly embedded.
- """
-
- raise NotImplementedError()
def type_descriptor(self, typeobj):
"""Transform a generic type to a database-specific type.
@@ -1339,7 +1335,7 @@ class ResultProxy(object):
metadata = self.cursor.description
if metadata is not None:
- typemap = self.dialect.dbapi_type_map()
+ typemap = self.dialect.dbapi_type_map
for i, item in enumerate(metadata):
# sqlite possibly prepending table name to colnames so strip
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index 198f6742b..a91d65b81 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -33,7 +33,8 @@ class DefaultDialect(base.Dialect):
supports_sane_multi_rowcount = True
preexecute_pk_sequences = False
supports_pk_autoincrement = True
-
+ dbapi_type_map = {}
+
def __init__(self, convert_unicode=False, encoding='utf-8', default_paramstyle='named', paramstyle=None, dbapi=None, **kwargs):
self.convert_unicode = convert_unicode
self.encoding = encoding
@@ -59,12 +60,6 @@ class DefaultDialect(base.Dialect):
property(lambda s: s.preexecute_sequences, doc=(
"Proxy to deprecated preexecute_sequences attribute.")))
- def dbapi_type_map(self):
- # most DB-APIs have problems with this (such as, psycocpg2 types
- # are unhashable). So far Oracle can return it.
-
- return {}
-
def create_execution_context(self, connection, **kwargs):
return DefaultExecutionContext(self, connection, **kwargs)