问题
I know pyodbc is an older project and probably more featureful and robust, but is there anything about its design (based on components of compiled C code), that would make it preferable to a pure Python implementation, such as pypyodbc?
I do a lot of ETL work and am thinking of switching from a Linux/Jython/JDBC approach to Windows/Cygwin/Python/ODBC approach.
回答1:
Potential advantages of pyodbc
over pypyodbc
by being written in C would be:
- speed - see the pypyodbc wiki comparison
- more conservative memory usage
Potential advantages of pypyodbc
over pyodbc
by written in Python would be:
- Less likely to contain C pointer issues
- Slightly less likely to contain memory allocation issues
- Simpler to maintain; a higher-level language means less lines of code
- Much much easier to install without compilation issues which require a separate build for separate versions of Python, platform etc
Advantages of maturity:
- Fewer bugs
- More comprehensive coverage of features
- Better handling of corner-cases
The maturity thing is largely dependent on pyodbc
not being buggy. In my experience that is not true and it has had a fair number of memory leak bugs etc. And see comments on this answer - there is evidence that pyodbc
can be quite problematic.
The author's claim is that pypyodbc
is a reimplementation of the pyodbc
code in Python, and that would mean that the feature coverage should be equivalent. There may be some corner cases that have been less tried in the newer code though.
Disclaimer: I haven't yet tried pypyodbc
来源:https://stackoverflow.com/questions/14463591/does-pyodbc-have-any-design-advantages-over-pypyodbc