summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2008-12-30 06:39:33 +0000
committerMichael Trier <mtrier@gmail.com>2008-12-30 06:39:33 +0000
commitdfd80ba089c0d0637f54cbd6b21332d5f5115999 (patch)
tree425e887594530d9be218cfa274c0a938cc9a33ee /lib/sqlalchemy/engine/base.py
parent4e8a817ac24e73f3e2d3e80f6939cefa7e9b0130 (diff)
downloadsqlalchemy-dfd80ba089c0d0637f54cbd6b21332d5f5115999.tar.gz
Added a new description_encoding attribute on the dialect.
This is used for encoding the column name when processing the metadata. This usually defaults to utf-8.
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r--lib/sqlalchemy/engine/base.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 24fd1cc6e..c547c0e54 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -107,6 +107,11 @@ class Dialect(object):
supports_default_values
Indicates if the construct ``INSERT INTO tablename DEFAULT VALUES`` is supported
+
+ description_encoding
+ type of encoding to use for unicode when working with metadata
+ descriptions. If set to ``None`` no encoding will be done.
+ This usually defaults to 'utf-8'.
"""
def create_connect_args(self, url):
@@ -1441,7 +1446,9 @@ class ResultProxy(object):
typemap = self.dialect.dbapi_type_map
for i, item in enumerate(metadata):
- colname = item[0].decode(self.dialect.encoding)
+ colname = item[0]
+ if self.dialect.description_encoding:
+ colname = colname.decode(self.dialect.description_encoding)
if '.' in colname:
# sqlite will in some circumstances prepend table name to colnames, so strip