for non-reflected "PARTITION" directives,
thanks to George Reilly [ticket:2376]
+- mssql
+ - [bug] Adjusted the regexp used in the
+ mssql.TIME type to ensure only six digits
+ are received for the "microseconds" portion
+ of the value, which is expected by
+ Python's datetime.time(). Note that
+ support for sending microseconds doesn't
+ seem to be possible yet with pyodbc
+ at least. [ticket:2340]
+
- Py3K
- [bug] Fixed inappropriate usage of util.py3k
flag and renamed it to util.py3k_warning, since
return value
return process
- _reg = re.compile(r"(\d+):(\d+):(\d+)(?:\.(\d+))?")
+ _reg = re.compile(r"(\d+):(\d+):(\d+)(?:\.(\d{0,6}))?")
def result_processor(self, dialect, coltype):
def process(value):
if isinstance(value, datetime.datetime):
from sqlalchemy.sql import table, column
from sqlalchemy.databases import mssql
from sqlalchemy.dialects.mssql import pyodbc, mxodbc, pymssql
+from sqlalchemy.dialects.mssql.base import TIME
from sqlalchemy.engine import url
from test.lib import *
from test.lib.testing import eq_, emits_warning_on, \
'Unrecognized server version info',
engine.connect)
+class TimeTypeTest(fixtures.TestBase):
+
+ def test_result_processor_no_microseconds(self):
+ expected = datetime.time(12, 34, 56)
+ self._assert_result_processor(expected, '12:34:56')
+
+ def test_result_processor_too_many_microseconds(self):
+ # microsecond must be in 0..999999, should truncate (6 vs 7 digits)
+ expected = datetime.time(12, 34, 56, 123456)
+ self._assert_result_processor(expected, '12:34:56.1234567')
+
+ def _assert_result_processor(self, expected, value):
+ mssql_time_type = TIME()
+ result_processor = mssql_time_type.result_processor(None, None)
+ eq_(expected, result_processor(value))
+
class TypesTest(fixtures.TestBase, AssertsExecutionResults, ComparesTables):
__only_on__ = 'mssql'