I'm trying to use the MsSqlOperator in my Airflow workflow, but I can't work out how to set the connection string.
I've tried setting mssql_conn_id to be the connection string itself
t2 = MsSqlOperator(
task_id='sql-op',
mssql_conn_id='sa:password@172.17.0.2',
sql='use results; insert into airflow value("airflow","out")',
dag=dag)
I get the error
airflow.exceptions.AirflowException: The conn_id `sa:password@172.17.0.2` isn't defined
so I suppose mssql_conn_id needs to be defined. Somewhere. Any ideas?
I'm able to connect to the MS SQL database using sqlalchemy like this:
params = urllib.quote_plus("DRIVER={ODBC Driver 13 for SQL Server};SERVER=172.17.0.2;UID=SA;PWD=password")
engine = create_engine("mssql+pyodbc:///?odbc_connect=%s" % params)
conn = engine.connect()
so I know the server is up and running.