SQL Server Hook and operator connection in Airflow

落爺英雄遲暮 提交于 2019-12-11 15:26:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!