vitalseeds / vs-data-api

Fast API endpoints to expose vs-data actions for to run from Filemaker
MIT License
0 stars 0 forks source link

Get pypyodbc working on Mac #48

Closed tombola closed 1 year ago

tombola commented 1 year ago

I got pypyodbc to use iodbc (rather than unixodbc) on mac by supplying this pull request - https://github.com/pypyodbc/pypyodbc/issues/26

This just allows pypyodbc to find libiodbc.dylib when libiodbc has been installed by homebrew.

It still only looks for iodbc if unixodbc is not present, otherwise that gets loaded instead.

At the time of writing this is still not present in a release of pypyodbc, so I am installing via git.


So, currently for pypyodbc to work for me on MacOs, the following should evaluate to None

python -c "from ctypes.util import find_library; print(find_library('odbc'))"

Otherwise pypyodbc tries to load unixodbc (and from incorrect path). To avoid this:

brew uninstall --ignore-dependencies unixodbc && brew install libiodbc

tombola commented 1 year ago

The relevant code in pypyodbc

https://github.com/pypyodbc/pypyodbc/blob/main/pypyodbc.py#L419-L484

tombola commented 1 year ago

I retrospect i wonder if the find_library() issue* might be symptomatic of a similar issue when I tried again to get pyodbc to run against filemaker, as that also returned an SQL Error when the library was not found.

* On mac the function just returns some expected paths, which are not accurate if installed using homebrew.