in data-mesh-banking-labs/setup/resources/composer/dags/create_transactions_data_classification_tag.py [0:0]
def read_entities_list(table_list_file):
"""
Reads the table list file that will help in creating Airflow tasks in
the DAG dynamically.
:param table_list_file: (String) The file location of the table list file,
e.g. '/home/airflow/framework/table_list.csv'
:return table_list: (List) List of tuples containing the source and
target tables.
"""
table_list = []
logger.info('Reading table_list_file from : %s' % str(table_list_file))
try:
with io.open(table_list_file, 'rt', encoding='utf-8') as csv_file:
csv_reader = csv.reader(csv_file)
next(csv_reader) # skip the headers
for row in csv_reader:
logger.info(row)
table_tuple = {
'entity_name': row[0]
}
table_list.append(table_tuple)
return table_list
except IOError as e:
logger.error('Error opening table_list_file %s: ' % str(
table_list_file), e)