You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to execute a series of SQL statements on Redshift.
I'd planned to use the SqlSensor to do this but failed to read the part of the documentation about executing a statement until a criteria is met. I just need to execute regardless of the result set.
Is there a way of doing this without using the PythonOperator and opening my own postgres connection? It looks as if I want a MySqlOperator for postgres.
Activity
martingrayson commentedon Jun 17, 2015
Sorry - I can see there's an optional package for postgres (that I even installed) ;) Its just not in the documentation yet.
[-]How to execute arbitrary SQL?[/-][+]How to execute arbitrary SQL in postgres?[/+]mistercrunch commentedon Jun 17, 2015
You want to use the
PostgresOperatordocumented here:http://pythonhosted.org/airflow/code.html#airflow.operators.PostgresOperator
Being the scene the operator uses a hook, you can use the hook build other operators (data transfer, sensors, ...) or within PythonOperator, but
PostgresOperatorallows you to do what you described.http://pythonhosted.org/airflow/code.html#airflow.hooks.PostgresHook
martingrayson commentedon Jun 17, 2015
Thanks mistercrunch 👍 I'm really not sure how I missed that in the documentation !
[EWT-115][EWT-118] Initialise dag var to None and fix for DagModel.fi…
Airflow Upgrade with Cherry-Picks [only] from 1.10.4+twtr (apache#64)
Merge pull request apache#39 from MarkPieszak/patch-1