[egenix-users] egenix mxodbc 3.3.1 and SQLAlchemy

Raghavan, Vinay raghavan.vinay at gmail.com
Wed Apr 15 22:08:16 CEST 2015

Has anyone got egenix 3.3.X to work with recent versions of SQLAlchemy
(0.8.X / 0.9.X) ?

With egenix mxodbc 3.3.1 (mx base 3.2.8) we are facing troubles when
working with

SQLAlchemy 0.7.6, as the ORM
unixODBC 2.3.0, as the driver manager
FreeTDS 0.82 or Microsoft ODBC Driver 11 for SQL Server on Linux (
https://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx) as
the db drivers

Update statements end up throwing StaleDataError. Has anyone encountered
StaleDataError with latest egenix mxodbc and resolved it; and with which
version of SQLAlchemy?

When digging further, with respect to the StaleDataError, a snippet seems
to have this condition (

   394        if value_params:
   395            c = connection.execute(
   396                                statement.values(value_params),
   397                                params)
   398        else:
   399            c = cached_connections[connection].\
   400                                execute(statement, params)

   401        _postfetch(
   402                mapper,
   403                uowtransaction,
   404                table,
   405                state,
   406                state_dict,
   407                c.context.prefetch_cols,
   408                c.context.postfetch_cols,
   409                c.context.compiled_parameters[0],
   410                value_params)
   411        rows += c.rowcount

   412    if connection.dialect.supports_sane_rowcount:
   413        if rows != len(update):
   414            raise orm_exc.StaleDataError(
   415                    "UPDATE statement on table '%s' expected to "
   416                    "update %d row(s); %d were matched." %
   417                    (table.description, len(update), rows))

pdb shows that connection.dialect.supports_sane_rowcount is set to True
since it is not overridden otherwise for mxodbc dialect. Is this proper? I
got this doubt since it is explicitly set otherwise in dialect for pymssql (

Looking at the history, (
) not many changes have happened after egenix mxodbc 3.2.1 certified for
SQLAlchemy 0.8.0b1 (

Right now, few of our team members are using FreeTDS and few others using
MS ODBC driver. The mentioned error is seen with either of these drivers.
Upgrading to a newer version of SQLAlchemy 0.9.X causes even selects to
fail, which seems to be a bigger concern.

Please share any inputs which you may have about the combination of
unixODBC, FreeTDS, SQLAlchemy and egenix mxodbc.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20150415/38ce7dc9/attachment.htm

More information about the egenix-users mailing list