I want to pull some data from a Microsoft SQL Server and into Postgres using Python/Django. The ODBC drivers come from http://www.actualtechnologies.com and I paid 30 quid for a small license that allows 5 concurrent users. It’s only me using it so I only need one so that’s cool. I say 30 quid -that’s for Mac. If you want to use their Linux version it will be somewhere around 600 quid. Hey ho. Well ok – I’ll just do this on a Mac then.
Now the problems start. Basically, the ODBC drivers won’t work with 64 bit apps. OK, So I’ll force my Snow Leopard python into 32 bit mode using.
jlp:~ icottee$ defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
Now psycopg2 won’t work. And I spend some time faffing around. Eventually I discover to get psycopg2 to work you’ll need to get yourself a 32 bit version of postgres. So the magic rule is download the code for postgres, configure and make install it AFTER you have done:
export CC="gcc -arch i386"
Now you reinstall psycopg2 and wahey you can at last get on with what you were supposed to be doing.