I'm pretty new to all of this. I have a MS SQL Server that I'm running a database on for my flask web application. I'm now trying to get my app on python anywhere connected to my SQL Server. When I'm running the flask web app on my loacl machine (different machine than the SQL Server). I configure files and then connect using sqlalchemy. I'm not sure how to do this in python anywhere because I can't edit the configuration files. Can anyone help me out?
I use the following connection details (key info redacted).
This is how I set up the three configuration files on my machine:
#/etc/freetds/freetds.conf
[MSSQL]
host = XXX.XXX.XXX
port = 1433
tds version = 4.2
# /etc/odbc.ini
[MSSQL]
Description =MSSQL Server
Driver =FreeTDS
Database=CashFlow
ServerName =MSSQL
Port =1433
#/etc/odbcinst.ini
[FreeTDS]
Description=Free TDS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Python Script to connect using sqlalchemy:
import pymssql
from sqlalchemy import *
connection_string = r"mssql+pymssql://{0}:{1}@MSSQL/CashFlow".format('username','password')
engine= create_engine(connection_string)