kameshkotwani commented on issue #27077:
URL: https://github.com/apache/airflow/issues/27077#issuecomment-1280510250
Thank you for considering it, meanwhile I was able to do the required task
using vanilla python and PythonOperator, I have attached the code, might help
someone with same requirement as mine.
```python
def _write_to_postgres(execution_date):
hour = execution_date.hour
day = execution_date.day
filename = f"queries{hour}{day}.sql"
import psycopg2
try:
conn = psycopg2.connect(database="airflow",user='airflow',
password='airflow', host='postgres', port= '5432')
except:
raise AirflowFailException
else:
cursor = conn.cursor()
with open(f"/opt/airflow/dags/{filename}","r") as f:
for statement in f.readlines():
print(statement)
cursor.execute(statement)
conn.commit()
cursor.close()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]