Need help connecting to SQL Server from Python Flask-Appbuilder Need help connecting to SQL Server from Python Flask-Appbuilder flask flask

Need help connecting to SQL Server from Python Flask-Appbuilder


if you are using pyodbc you should be able to connect this way

import pyodbccnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=yourServer;DATABASE=yourDatabase;UID=;PWD=')#putting to useSQL = "select Field1, Field2 from someTable"cursor = cnxn.cursor()cursor.execute(SQL)row = cursor.fetchall()for r in row:    print r[0] #field1    print r[1] #field2


The port should be specified through a comma. Specify the connection string as

DRIVER={SQL Server};SERVER=devsql07,1433;DATABASE.....