win32all odbc/MS SQLServer/bigint
M.-A. Lemburg
mal at lemburg.com
Sat Apr 12 03:35:50 EDT 2003
Bjorn Pettersen wrote:
> We were using the win32all odbc module, trying to fix some records in
> our database. Our account IDs are of SQL type bigint, i.e. __int64 if
> you're on MS. After seeing incorrect results (and spending some time
> looking at our own code), it turns out that the odbc module silently
> corrupts data in paramters passed to cursor.execute(). Has anyone seen
> this/got a workaround for it (we're currently cast'ing to varchar on
> selects, and doing string substitution elsewhere, which is killing
> performance, and we can't get it to work in subselects...)?
The win32all odbc module fetches BIGINTs as floats. That's
where you probably get your corruption from...
> I looked at
> the mxODBC documentation, and it says it's doing a conversion
> [automatic] to string for bigint data... (again too slow). I'm pretty
> flummoxed, the ODBC C calls for bigint/__int64 are pretty straight
> forward(?)
They are ? __int64 is not exactly portable across platforms...
BTW, conversion from strings to Python longs is done in C,
so it's not as slow as you may think.
> As an added bonus, someone had the pleasure of showing me that a simple
> select/fetchall (i.e. all C code for Python), was over three times
> faster in C#..., and the win32all odbc module has crashed python
> somewhere deep down in sql three times in the last two hours (we're
> expecting this app to run for ~4 days...). Looks like it's back to C++
> (*sigh*).
Have you tried mxODBC on this ? We have many customers running
mxODBC under Zope on heavily loaded sites for weeks... so far
without any complaints about its stability.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Software directly from the Source (#1, Apr 12 2003)
>>> Python/Zope Products & Consulting ... http://www.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
EuroPython 2003, Charleroi, Belgium: 73 days left
More information about the Python-list
mailing list