summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-01-12 19:51:13 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-01-12 19:51:13 -0500
commit46a9209cde6e9e8bf333eada55ef45193f3f4fff (patch)
tree7697a03cc8951fc8d9d93fca8ebef821395d4a32
parent84260339dd52fa4a7d20e710f54451cea55a2eac (diff)
downloadsqlalchemy-46a9209cde6e9e8bf333eada55ef45193f3f4fff.tar.gz
Added a py3K conditional around unnecessary .decode()
call in mssql information schema, fixes reflection in Py3K. Also in 0.7.10. [ticket:2638]
-rw-r--r--doc/build/changelog/changelog_07.rst8
-rw-r--r--doc/build/changelog/changelog_08.rst8
-rw-r--r--lib/sqlalchemy/dialects/mssql/information_schema.py2
-rw-r--r--test/dialect/test_mssql.py7
4 files changed, 25 insertions, 0 deletions
diff --git a/doc/build/changelog/changelog_07.rst b/doc/build/changelog/changelog_07.rst
index b98ff0d83..cb88cd940 100644
--- a/doc/build/changelog/changelog_07.rst
+++ b/doc/build/changelog/changelog_07.rst
@@ -9,6 +9,14 @@
:released:
.. change::
+ :tags: mssql, bug
+ :tickets: 2638
+
+ Added a Py3K conditional around unnecessary .decode()
+ call in mssql information schema, fixes reflection
+ in Py3k.
+
+ .. change::
:tags: orm, bug
:tickets: 2650
diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst
index a45137167..3abac5025 100644
--- a/doc/build/changelog/changelog_08.rst
+++ b/doc/build/changelog/changelog_08.rst
@@ -7,6 +7,14 @@
:version: 0.8.0
.. change::
+ :tags: mssql, bug
+ :tickets: 2638
+
+ Added a py3K conditional around unnecessary .decode()
+ call in mssql information schema, fixes reflection
+ in Py3K. Also in 0.7.10.
+
+ .. change::
:tags: orm, bug
:tickets: 2650
diff --git a/lib/sqlalchemy/dialects/mssql/information_schema.py b/lib/sqlalchemy/dialects/mssql/information_schema.py
index 15551e5e4..35ce2450e 100644
--- a/lib/sqlalchemy/dialects/mssql/information_schema.py
+++ b/lib/sqlalchemy/dialects/mssql/information_schema.py
@@ -16,8 +16,10 @@ class CoerceUnicode(TypeDecorator):
impl = Unicode
def process_bind_param(self, value, dialect):
+ # Py2K
if isinstance(value, str):
value = value.decode(dialect.encoding)
+ # end Py2K
return value
schemata = Table("SCHEMATA", ischema,
diff --git a/test/dialect/test_mssql.py b/test/dialect/test_mssql.py
index 972602378..8c1c0873a 100644
--- a/test/dialect/test_mssql.py
+++ b/test/dialect/test_mssql.py
@@ -1990,6 +1990,13 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults):
fp.close()
return stream
+class InfoCoerceUnicodeTest(fixtures.TestBase):
+ def test_info_unicode_coercion(self):
+ from sqlalchemy.dialects.mssql.information_schema import CoerceUnicode
+
+ dialect = mssql.dialect()
+ value = CoerceUnicode().bind_processor(dialect)('a string')
+ assert isinstance(value, unicode)
class ReflectHugeViewTest(fixtures.TestBase):
__only_on__ = 'mssql'