From f848140083c316b81456c8c3426ad3fd04caf6fa Mon Sep 17 00:00:00 2001 From: Gord Thompson Date: Sat, 25 Jun 2022 10:34:51 -0600 Subject: Change setinputsizes behavior for mssql+pyodbc The ``use_setinputsizes`` parameter for the ``mssql+pyodbc`` dialect now defaults to ``True``; this is so that non-unicode string comparisons are bound by pyodbc to pyodbc.SQL_VARCHAR rather than pyodbc.SQL_WVARCHAR, allowing indexes against VARCHAR columns to take effect. In order for the ``fast_executemany=True`` parameter to continue functioning, the ``use_setinputsizes`` mode now skips the ``cursor.setinputsizes()`` call specifically when ``fast_executemany`` is True and the specific method in use is ``cursor.executemany()``, which doesn't support setinputsizes. The change also adds appropriate pyodbc DBAPI typing to values that are typed as :class:`_types.Unicode` or :class:`_types.UnicodeText`, as well as altered the base :class:`_types.JSON` datatype to consider JSON string values as :class:`_types.Unicode` rather than :class:`_types.String`. Fixes: #8177 Change-Id: I6c8886663254ae55cf904ad256c906e8f5e11f48 --- test/dialect/mssql/test_engine.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/dialect/mssql/test_engine.py b/test/dialect/mssql/test_engine.py index 296820539..967ca85fe 100644 --- a/test/dialect/mssql/test_engine.py +++ b/test/dialect/mssql/test_engine.py @@ -474,11 +474,10 @@ class FastExecutemanyTest(fixtures.TestBase): use_fastexecutemany, apply_setinputsizes_flag, ): - expect_failure = ( - apply_setinputsizes_flag - and not include_setinputsizes - and use_fastexecutemany - ) + + # changes for issue #8177 have eliminated all current expected + # failures, but we'll leave this here in case we need it again + expect_failure = False engine = fe_engine(use_fastexecutemany, apply_setinputsizes_flag) -- cgit v1.2.1