问题
I am new to using airflow and what I need to do is to use MssqlHook
or MssqlOperator
but I do not know how.
By using hook and operator below code
hook = MsSqlHook(mssql_conn_id=ms_sql)
t2 = MsSqlOperator(
task_id = 'sql-op',
mssql_conn_id = ms_sql,
sql = 'Select Current_date()',
dag = dag)
in Airflow UI connections-
Conn Id - ms_sql
Conn Type -Microsoft SQL server
Host - host_name
schema- default
login- username
password- password
port - 14481
And when I do this the error is
Connection failed for unknown reason
How should I connect?
来源:https://stackoverflow.com/questions/53954928/sql-server-hook-and-operator-connection-in-airflow