egenix mxodbc 3.3.1 and SQLAlchemy
"Raghavan, Vinay" <[email protected]> Wed, 15 Apr 2015 21:08:16 +0530
| Newsgroups | gmane.comp.python.egenix.user |
|---|---|
| Message-ID | <CAAoHXV2_8TUut_TFsyQU=2t2NQJBoFQyqrfrnwwRu5ucfnjCkQ@mail.gmail.com> |
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 ( https://github.com/zzzeek/sqlalchemy/blob/rel_0_7_6/lib/sqlalchemy/orm/persistence.py#L478 onwards) 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 ( https://github.com/zzzeek/sqlalchemy/blob/rel_0_7_6/lib/sqlalchemy/dialects/mssql/pymssql.py#L53 ) Looking at the history, ( https://github.com/zzzeek/sqlalchemy/commits/master/lib/sqlalchemy/dialects/mssql/mxodbc.py ) not many changes have happened after egenix mxodbc 3.2.1 certified for SQLAlchemy 0.8.0b1 ( https://github.com/zzzeek/sqlalchemy/commit/7e815c67a9b90774fbb9fa1865a7d79113ef3612#diff-e4eb329834da3d36278b1b7d943b3bc9L613 ) 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. -- Regards, raghava _______________________________________________________________________ eGenix.com User Mailing List http://www.egenix.com/ https://www.egenix.com/mailman/listinfo/egenix-users