Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does pyodbc have any design advantages over pypyodbc?

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.

like image 271
Tony Avatar asked Jan 22 '13 16:01

Tony


People also ask

What is the difference between Pyodbc and Pypyodbc?

pypyodbc is very similar to pyodbc, except that it is written in pure Python under the hood. It can also be installed via pip. Our code above can be run exactly the same way, except we replace pyodbc with pypyodbc.

What is Python Pyodbc?

Pyodbc is an open source Python module that makes accessing ODBC databases simple. It implements the DB API 2.0 specification. Using pyodbc, you can easily connect Python applications to data sources with an ODBC driver.


1 Answers

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 past experience (around 2016) that was not true and it had had a fair number of memory leak bugs etc. But since then pyodbc has been improved significantly and is now properly maintained.

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

like image 185
David Fraser Avatar answered Sep 18 '22 21:09

David Fraser