diff options
author | Michael Trier <mtrier@gmail.com> | 2008-12-30 06:39:33 +0000 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2008-12-30 06:39:33 +0000 |
commit | dfd80ba089c0d0637f54cbd6b21332d5f5115999 (patch) | |
tree | 425e887594530d9be218cfa274c0a938cc9a33ee /lib/sqlalchemy/databases/mssql.py | |
parent | 4e8a817ac24e73f3e2d3e80f6939cefa7e9b0130 (diff) | |
download | sqlalchemy-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/databases/mssql.py')
-rw-r--r-- | lib/sqlalchemy/databases/mssql.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 95be55e7f..ad9ba847a 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -922,9 +922,10 @@ class MSSQLDialect(default.DefaultDialect): return object.__new__(cls, *args, **kwargs) def __init__(self, - auto_identity_insert=True, query_timeout=None, text_as_varchar=False, - use_scope_identity=False, has_window_funcs=False, max_identifier_length=None, - schema_name="dbo", **opts): + auto_identity_insert=True, query_timeout=None, + text_as_varchar=False, use_scope_identity=False, + has_window_funcs=False, max_identifier_length=None, + schema_name="dbo", description_encoding='utf-8', **opts): self.auto_identity_insert = bool(auto_identity_insert) self.query_timeout = int(query_timeout or 0) self.schema_name = schema_name @@ -934,7 +935,7 @@ class MSSQLDialect(default.DefaultDialect): self.use_scope_identity = bool(use_scope_identity) self.has_window_funcs = bool(has_window_funcs) self.max_identifier_length = int(max_identifier_length or 0) or 128 - super(MSSQLDialect, self).__init__(**opts) + super(MSSQLDialect, self).__init__(description_encoding=description_encoding, **opts) @classmethod def dbapi(cls, module_name=None): @@ -1240,8 +1241,8 @@ class MSSQLDialect_pyodbc(MSSQLDialect): supports_unicode_statements = supports_unicode execution_ctx_cls = MSSQLExecutionContext_pyodbc - def __init__(self, **params): - super(MSSQLDialect_pyodbc, self).__init__(**params) + def __init__(self, description_encoding='latin-1', **params): + super(MSSQLDialect_pyodbc, self).__init__(description_encoding=description_encoding, **params) # FIXME: scope_identity sniff should look at server version, not the ODBC driver # whether use_scope_identity will work depends on the version of pyodbc try: @@ -1569,3 +1570,4 @@ dialect.statement_compiler = MSSQLCompiler dialect.schemagenerator = MSSQLSchemaGenerator dialect.schemadropper = MSSQLSchemaDropper dialect.preparer = MSSQLIdentifierPreparer + |