Python - Attributeerror: 'nonetype' Object Has No Attribute 'execute'
I am trying to run a python script that logs into Amazon Redshift DB and then execute a SQL command. I use a tool called Airflow for workflow management. When running the below cod
Solution 1:
Are you sure you've added the entirety of your code? You call the data_warehouse_login
function in the first task's python_callable but that is undefined. Assuming that this is meant to be db_log
and the first task was successful, you're not actually xcom-ing anything to the second task (as your xcom_push
only triggers on error).
Generally wouldn't advise xcom-ing a connection object anyway. Alternatively, you may want to consider using the included PostgresHook, which should cover your use case and works equally well with Amazon Redshift.
https://github.com/apache/incubator-airflow/blob/master/airflow/hooks/postgres_hook.py
Post a Comment for "Python - Attributeerror: 'nonetype' Object Has No Attribute 'execute'"