OrderingList from being pickleable
[ticket:2454]. Courtesy Jeff Dairiki
+- sql
+ - [bug] Removed warning when Index is created
+ with no columns; while this might not be what
+ the user intended, it is a valid use case
+ as an Index could be a placeholder for just an
+ index of a certain name.
+
+- mssql
+ - [feature] Added interim create_engine flag
+ supports_unicode_binds to PyODBC dialect,
+ to force whether or not the dialect
+ passes Python unicode literals to PyODBC
+ or not.
+
- postgresql
- [feature] Added new for_update/with_lockmode()
options for Postgresql: for_update="read"/
# if the libessqlsrv.so is detected
easysoft = False
+ def __init__(self, supports_unicode_binds=None, **kw):
+ super(PyODBCConnector, self).__init__(**kw)
+ self._user_supports_unicode_binds = supports_unicode_binds
+
@classmethod
def dbapi(cls):
return __import__('pyodbc')
# have not tried pyodbc + python3.1 yet.
# Py2K
self.supports_unicode_statements = not self.freetds and not self.easysoft
- self.supports_unicode_binds = (not self.freetds or
- self.freetds_driver_version >= '0.91') and not self.easysoft
+ if self._user_supports_unicode_binds is not None:
+ self.supports_unicode_binds = self._user_supports_unicode_binds
+ else:
+ self.supports_unicode_binds = (not self.freetds or
+ self.freetds_driver_version >= '0.91'
+ ) and not self.easysoft
# end Py2K
# run other initialization which asks for user name, etc.
>>> urllib.quote_plus('dsn=mydsn;Database=db')
'dsn%3Dmydsn%3BDatabase%3Ddb'
+Unicode Binds
+^^^^^^^^^^^^^
+
+The current state of PyODBC on a unix backend with FreeTDS and/or
+EasySoft is poor regarding unicode; different OS platforms and versions of UnixODBC
+versus IODBC versus FreeTDS/EasySoft versus PyODBC itself dramatically
+alter how strings are received. The PyODBC dialect attempts to use all the information
+it knows to determine whether or not a Python unicode literal can be
+passed directly to the PyODBC driver or not; while SQLAlchemy can encode
+these to bytestrings first, some users have reported that PyODBC mis-handles
+bytestrings for certain encodings and requires a Python unicode object,
+while the author has observed widespread cases where a Python unicode
+is completely misinterpreted by PyODBC, particularly when dealing with
+the information schema tables used in table reflection, and the value
+must first be encoded to a bytestring.
+
+It is for this reason that whether or not unicode literals for bound
+parameters be sent to PyODBC can be controlled using the
+``supports_unicode_binds`` parameter to ``create_engine()``. When
+left at its default of ``None``, the PyODBC dialect will use its
+best guess as to whether or not the driver deals with unicode literals
+well. When ``False``, unicode literals will be encoded first, and when
+``True`` unicode literals will be passed straight through. This is an interim
+flag that hopefully should not be needed when the unicode situation stabilizes
+for unix + PyODBC. New in 0.7.7.
"""
self.table = None
# will call _set_parent() if table-bound column
# objects are present
- if not columns:
- util.warn("No column names or expressions given for Index.")
ColumnCollectionMixin.__init__(self, *columns)
self.name = name
self.unique = kw.pop('unique', False)
def _server_side_cursors(options, opt_str, value, parser):
db_opts['server_side_cursors'] = True
+
def _zero_timeout(options, opt_str, value, parser):
warnings.warn("--zero-timeout testing option is now on in all cases")
Index, "foo", 5
)
- def test_warn_no_columns(self):
- assert_raises_message(
- exc.SAWarning,
- "No column names or expressions given for Index.",
- Index, "foo"
- )
+ def test_no_warning_w_no_columns(self):
+ Index(name="foo")
def test_raise_clauseelement_not_a_column(self):
m = MetaData()