needs to be modified to use column.in_(select)
explicitly. [ticket:2277]
+ - [feature] updated support for the mxodbc
+ driver; mxodbc 3.2.1 is recommended for full
+ compatibility.
+
- postgresql
- [feature] postgresql.ARRAY features an optional
if context:
native_odbc_execute = context.execution_options.\
get('native_odbc_execute', 'auto')
- if native_odbc_execute is True:
- # user specified native_odbc_execute=True
- return False
- elif native_odbc_execute is False:
- # user specified native_odbc_execute=False
- return True
- elif context.is_crud:
- # statement is UPDATE, DELETE, INSERT
- return False
- else:
- # all other statements
- return True
+ # default to direct=True in all cases, is more generally
+ # compatible especially with SQL Server
+ return False if native_odbc_execute is True else True
else:
return True
- #def do_executemany(self, cursor, statement, parameters, context=None):
- # cursor.executemany(statement, parameters, direct=self._get_direct(context))
+ def do_executemany(self, cursor, statement, parameters, context=None):
+ cursor.executemany(statement, parameters, direct=self._get_direct(context))
def do_execute(self, cursor, statement, parameters, context=None):
cursor.execute(statement, parameters, direct=self._get_direct(context))
from ... import types as sqltypes
from ...connectors.mxodbc import MxODBCConnector
-from .pyodbc import MSExecutionContext_pyodbc
+from .pyodbc import MSExecutionContext_pyodbc, _MSNumeric_pyodbc
from .base import (MSDialect,
MSSQLStrictCompiler,
_MSDateTime, _MSDate, _MSTime)
+class _MSNumeric_mxodbc(_MSNumeric_pyodbc):
+ """Include pyodbc's numeric processor.
+ """
class _MSDate_mxodbc(_MSDate):
def bind_processor(self, dialect):
class MSDialect_mxodbc(MxODBCConnector, MSDialect):
- # TODO: may want to use this only if FreeTDS is not in use,
- # since FreeTDS doesn't seem to use native binds.
- statement_compiler = MSSQLStrictCompiler
+ # this is only needed if "native ODBC" mode is used,
+ # which is now disabled by default.
+ #statement_compiler = MSSQLStrictCompiler
+
execution_ctx_cls = MSExecutionContext_mxodbc
+
+ # flag used by _MSNumeric_mxodbc
+ _need_decimal_fix = True
+
colspecs = {
- #sqltypes.Numeric : _MSNumeric,
+ sqltypes.Numeric : _MSNumeric_mxodbc,
sqltypes.DateTime : _MSDateTime,
sqltypes.Date : _MSDate_mxodbc,
sqltypes.Time : _MSTime_mxodbc,
class _MSNumeric_pyodbc(sqltypes.Numeric):
"""Turns Decimals with adjusted() < 0 or > 7 into strings.
- This is the only method that is proven to work with Pyodbc+MSSQL
- without crashing (floats can be used but seem to cause sporadic
- crashes).
+ The routines here are needed for older pyodbc versions
+ as well as current mxODBC versions.
"""
'c2': 'some data', 'c1': 5},
(5, 'some data')),
('SELECT lower', {'lower_2': 'Foo'},
- () if testing.against('mssql+mxodbc') else
('Foo', )),
('INSERT INTO t1 (c1, c2)',
{'c2': 'foo', 'c1': 6},
('INSERT INTO t1 (c1, c2)', {'c2': 'some data', 'c1'
: 5}, (5, 'some data')),
('SELECT lower', {'lower_2': 'Foo'},
- () if testing.against('mssql+mxodbc')
- else ('Foo', )),
+ ('Foo', )),
('INSERT INTO t1 (c1, c2)', {'c2': 'foo', 'c1': 6},
(6, 'foo')),
('select * from t1', {}, ()),
import datetime, os
from sqlalchemy import *
from sqlalchemy import event
-from sqlalchemy import sql
+from sqlalchemy import sql, util
from sqlalchemy.orm import *
from sqlalchemy.ext.horizontal_shard import ShardedSession
from sqlalchemy.sql import operators
# TODO: ShardTest can be turned into a base for further subclasses
class ShardTest(fixtures.TestBase):
+ __skip_if__ = (lambda: util.win32,)
+
def setUp(self):
global db1, db2, db3, db4, weather_locations, weather_reports
)
class TableTest(fixtures.TestBase, AssertsCompiledSQL):
+ @testing.skip_if('mssql', 'different col format')
def test_prefixes(self):
from sqlalchemy import Table
table1 = Table("temporary_table_1", MetaData(),
@testing.emits_warning('.*empty sequence.*')
@testing.fails_on('firebird', "uses sql-92 rules")
@testing.fails_on('sybase', "uses sql-92 rules")
- @testing.fails_on('mssql+mxodbc', "uses sql-92 rules")
@testing.fails_if(lambda:
testing.against('mssql+pyodbc') and not testing.db.dialect.freetds,
"uses sql-92 rules")
)
class UpdateFromRoundTripTest(_UpdateFromTestBase, fixtures.TablesTest):
- __testing_engine__ = {'execution_options':{'native_odbc_execute':False}}
@testing.requires.update_from
def test_exec_two_table(self):