On 12 mrt, 21:47, "polaar" <[EMAIL PROTECTED]> wrote:
> FYI, specifying module=pyodbc didn't seem to help wrt the
> ConcurrentModificationError. Didn't have very much time, had a (very)
> quick look at the code in mssql.py, and at first sight, it would seem
> that sane_rowcount is a global variable that is only set in the
> use_pyodbc() (resp. adodbapy/pymssql) function, which in turn is only
> called from use-default(), this would seem to mean only when you don't
> specify a module... Either I'm completely wrong (which is very well
> possible ;-), as I said, I only took a quick look, and I'm not
> familiar with the code), or this means that you may not have adodbapi
> (or pymssql) installed in order to use pyodbc correctly???
>

Update: it indeed seems to work like that. I tried changing the order
of preference in  mssql.py so that it first tries pydobc, and that
seems to work: the ConcurrentModificationError no longer occurs. I now
also get a warning about using pyodbc that I didn't get before. (by
the way: I did have to keep the 'set nocount on'  in order to prevent
the invalid cursor state problem)

I guess something could be done with changing the following line from
the __init__ method of class MSSQLDialect:
self.module = module or dbmodule or use_default()
to something that calls use_pyodbc/use_pymssql/use_adodbapi based on
module.__name__? (I'm not sure though: use_default seems to be called
already when the mssql is imported and it sets the global dbmodule, so
I'm not confident that this is where it should be done*)
Something like this?

{'pyodbc': use_pyodbc, 'adodbapi': use_adodbapi, 'pyodbc':
use_pyodbc}.get(module.__name__, use_default)()

Steven

* can't test it at home (using linux), and as using python at work is
mostly 'under the radar', I can't spend a lot of time on it there, so
sorry if I can't provide you with a well-tested patch ;-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to