I'm trying to do a automate migration from sqlserver
to postgres
, so I tryed to use pyodbc then installed it
pip install pyodbc
And after I try to do a connection with python with below code:
import pyodbc
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=192.168.0.12;DATABASE=Aval;UID=sa;PWD=1032')
cursor = cnxn.cursor()
cursor.execute("select * from user")
rows = cursor.fetchall()
for row in rows:
print row.user_id, row.user_name
The when I atempt to run it I get the following mistake:
Traceback (most recent call last):
File "migracion.py", line 1, in <module>
import pyodbc
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/pyodbc.so, 2): Library not loaded: /usr/local/lib/libodbc.2.dylib
Referenced from: /usr/local/lib/python2.7/site-packages/pyodbc.so
Reason: image not found
Environment Information:
- SO: Mac yosemite
- python version: 2.7.10
- pip version: pip 7.1.0 from /usr/local/lib/python2.7/site-packages (python 2.7)