我尝试在Airflow中运行存储过程.简而言之,我导入了mssql运算符,并尝试执行以下操作:
I try to run my stored procedure in Airflow. Simply, I imported mssql operator and tried to execute following:
sql_command = """ EXEC [spAirflowTest] """ t3 = MsSqlOperator( task_id = 'run_test_proc', mssql_conn_id = 'FIConnection', sql = sql_command, dag = dag, database = 'RDW')成功完成此任务.但是,任务甚至没有执行.因为我没有从系统中得到任何错误,所以我也无法识别该错误.为了确定它是否到达了我的Microsoft sql服务器,我检查了数据配置文件,发现服务器似乎获得了该命令,但未执行该命令.确实,我可以在数据分析工具中看到sql命令.
It completes this task as successful. However, task is not even executed. Because I get no error from system, I also cannot identify the error. To identify whether it arrived to my microsoft sql server, I checked with data profiling and it seems like server gets the command but does not execute it. Indeed, I can see sql command in data profiling tool.
当我运行命令以读取某些内容时,例如:
When I run command for reading something, like :
select * from sys.tables它也成功返回结果.我怎么解决这个问题?是否有人遇到过此问题?
it returns successful, also, with result. How can I solve this problem? Is there anyone who encountered with this issue?
推荐答案sql_command = """ EXEC [spAirflowTest] """ t3 = MsSqlOperator( task_id = 'run_test_proc', mssql_conn_id = 'FIConnection', sql = sql_command, dag = dag, database = 'RDW', autocommit = True)
通过添加上述自动提交功能解决了该问题
adding autocommit as above solved the issue
更多推荐
在气流中运行存储过程
发布评论