внтури PythonOperator такую функцию
python вызываю
def get_results():
request = "SELECT * FROM users"
pg_hook = PostgresHook(postgre_conn_id="gres", schema="postgres")
connection = pg_hook.get_conn()
cursor = connection.cursor()
cursor.execute(request)
results = cursor.fetchall()
file = open("sample1.txt","w")
file.write(results)
file.close()
сохрнаит ли в файл?
Мне кажется вам проще заюзать copy