Include odbc and mssql support with pypyodbc.py

1,220 views
Skip to first unread message

Derek

unread,
Feb 4, 2013, 7:09:31 PM2/4/13
to web...@googlegroups.com
Any way we can add this?


It's a pure python implementation of pyodbc. I've tested it with pypy1.9 on web2py 2.3.2 and it works fine (yes, I edited dal.py and renamed all instances of pyodbc to pypyodbc). 

Massimo Di Pierro

unread,
Feb 5, 2013, 9:45:28 AM2/5/13
to web...@googlegroups.com
I tried:

from contrib.pypyodbc import pypyodbc as pyodbc 

and I get:

gluon.contrib.pypyodbc.OdbcNoLibrary: 'ODBC Library is not found'

Can you help?

Mariano Reingart

unread,
Feb 5, 2013, 10:57:35 AM2/5/13
to web...@googlegroups.com
I think pyodbc works great on windows, for unix you should compile it
with unixODBC support:

http://code.google.com/p/pyodbc/wiki/Building

Anyway, surely in unix you will not have a tipical ODBC database to
test (MS SQLServer, MS Access, etc.) ...

Best regards

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Derek

unread,
Feb 5, 2013, 1:53:07 PM2/5/13
to web...@googlegroups.com
As I said, I edited dal.py and replaced references to pyodbc to pypyodbc and that seemed to work. I believe the only adapter referencing it as a driver was the mssql driver.

Massimo Di Pierro

unread,
Feb 5, 2013, 2:26:32 PM2/5/13
to web...@googlegroups.com
Which os? Not for me.

Derek

unread,
Feb 5, 2013, 3:06:00 PM2/5/13
to
This was on Windows.

It appears to be looking in these locations:
"/usr/lib/libodbc.so","/usr/lib/i386-linux-gnu/libodbc.so","/usr/lib/x86_64-linux-gnu/libodbc.so"

So, if it's not in those locations, you might want to add your libodbc.so location.

line 462 of pypyodbc.py

Yes, so it appears the OS.Exists(path) for those three locations didn't exist. So either your libodbc is in a different place, or you don't have it installed.

Massimo Di Pierro

unread,
Feb 5, 2013, 5:22:45 PM2/5/13
to web...@googlegroups.com
What you are telling me is that pypyodbc does not require additional python packages but it requires odbc.


On Tuesday, 5 February 2013 14:02:54 UTC-6, Derek wrote:
This was on Windows.

It appears to be looking in these locations:
"/usr/lib/libodbc.so","/usr/lib/i386-linux-gnu/libodbc.so","/usr/lib/x86_64-linux-gnu/libodbc.so"

So, if it's not in those locations, you might want to add your libodbc.so location.

line 462 of pypyodbc.py

Yes, so it appears the OS.Exists(path) for those three locations didn't exist. So either your libodbc is in a different place, or you don't have it installed.

Derek

unread,
Feb 5, 2013, 7:47:28 PM2/5/13
to web...@googlegroups.com
Yup. It uses ctypes to access your existing odbc libraries.

江文

unread,
Feb 8, 2013, 9:03:06 AM2/8/13
to web...@googlegroups.com
Massimo Di Pierro <massimo.dipierro@...> writes:

>
>
> What you are telling me is that pypyodbc does not require additional
python packages but it requires odbc.
>
>

Hi, I'm the maintainer of pypyodbc. I noticed you meet the library
loading problem and I re-looked at the code, and I uploaded a
patch that will fix the library loading problem.

It's ture pypyodbc requires odbc (the unixodbc package), and like
pypyodbc, pyodbc also requires that on linux. However, in the previous
version, it seems pypyodbc didn't find your libodbc.so library
correctly. I updated the way how pypyodbc find the lib, and I think
this may be able to solve the problem.

You can download the latest verson at
http://pypyodbc.googlecode.com/svn/trunk/pypyodbc/pypyodbc.py

Massimo Di Pierro

unread,
Feb 8, 2013, 1:58:05 PM2/8/13
to web...@googlegroups.com, jiang...@gmail.com
Thank you very much for your work.

We plan to include pypyodbc.py (only this file) in web2py under contrib. Would that be ok? Is the license mentioned in the file itself sufficient or should we ship a separate license file?

Massimo

江文

unread,
Feb 8, 2013, 8:22:28 PM2/8/13
to web...@googlegroups.com
Massimo Di Pierro <massimo.dipierro@...> writes:

>
>
> Thank you very much for your work.
>
> We plan to include pypyodbc.py (only this file) in web2py under contrib. Would
that be ok? Is the license mentioned in the file itself sufficient or should we
ship a separate license file?
>
> MassimoOn Friday, 8 February 2013 08:03:06 UTC-6, 江文 wrote:Massimo Di
Pierro <massimo.dipierro <at> ...> writes:
> >
> >
> > What you are telling me is that pypyodbc does not require additional
> python packages but it requires odbc.
> >
> >
> Hi, I'm the maintainer of pypyodbc. I noticed you meet the library
>  loading problem and I re-looked at the code, and I uploaded a
>  patch that will fix the library loading problem.
> It's ture pypyodbc requires odbc (the unixodbc package), and like
> pypyodbc, pyodbc also requires that on linux. However, in the previous
> version, it seems pypyodbc didn't find your libodbc.so library
> correctly. I updated the way how pypyodbc find the lib, and I think
> this may be able to solve the problem.
> You can download the latest verson at
> http://pypyodbc.googlecode.com/svn/trunk/pypyodbc/pypyodbc.py
>
>
>
>

Hi, Massimo,
Yes, both the way you including the script and the license
mentioned in the file itself is sufficient.
It's good to see pypyodbc is included in web2py :)



Reply all
Reply to author
Forward
0 new messages