Обновить postgre-localhost-demo.py
This commit is contained in:
@@ -28,9 +28,7 @@ def save_query_to_csv(**kwargs):
|
|||||||
from airflow.providers.postgres.hooks.postgres import PostgresHook
|
from airflow.providers.postgres.hooks.postgres import PostgresHook
|
||||||
pg_hook = PostgresHook(postgres_conn_id='pg-localhost-demo')
|
pg_hook = PostgresHook(postgres_conn_id='pg-localhost-demo')
|
||||||
|
|
||||||
sql = "SELECT * FROM bookings.segments s
|
sql = "SELECT * FROM bookings.segments s join bookings.flights f on s.flight_id = f.flight_id limit 100"
|
||||||
join bookings.flights f on s.flight_id = f.flight_id
|
|
||||||
limit 100"
|
|
||||||
|
|
||||||
records = pg_hook.get_records(sql)
|
records = pg_hook.get_records(sql)
|
||||||
columns = [desc[0] for desc in pg_hook.get_conn().cursor().description]
|
columns = [desc[0] for desc in pg_hook.get_conn().cursor().description]
|
||||||
|
|||||||
Reference in New Issue
Block a user