Created
May 31, 2020 18:11
-
-
Save kafran/53f0e5ea0433ec9a9c9692304e3263e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow.utils import db | |
from airflow.models import Connection | |
import csv | |
outfile = open('myconnections.csv', 'w') | |
outcsv = csv.writer(outfile) | |
with db.create_session() as session: | |
connections = session.query(Connection).all() | |
conn_list = [ | |
[getattr(c, column.name) for column in Connection.__mapper__.columns] | |
for c in connections | |
] | |
outcsv.writerows(conn_list) | |
outfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment