setup ms odbc
################## install msodbc 17 ####################
sudo curl https://packages.microsoft.com/config/rhel/7/prod.repo > mssql-release.repo --proxy http://xxxx.xxx.xx.x:8080 #download the repo using the old proxy, the bcproxy somehow doesnt work
sudo mv mssql-release.repo /etc/yum.repos.d/mssql-release.repo #move the repo to yum.repos.d
################### config yum ###################
/etc/yum.conf
gpgcheck=0 #skip gpg key
sslverify=0 #skip certificate check
proxy=http://xxx.xxx.xxx.xxx:8080 #add the proxy to yum.conf if needed
sudo yum update
sudo ACCEPT_EULA=Y yum install msodbcsql17 #install the odbc driver 17 for sql server
sudo yum install pyodbc #the python odbc library
-----------------create a test_model.py using the following codes----------------------------
import pyodbc
conn = pyodbc.connect("DRIVER={ODBC Driver 17 for SQL Server};SERVER=xxx.xxx.xx.xx;DATABASE=dbname;uid=user;pwd=password;")
cursor = conn.cursor()
cursor.execute('SELECT Declined,Is_Work_Hour,Num_Incident FROM model.Online_Claim_All_Claim_Training_VW')
rows = cursor.fetchall()