Skip to content

Commit cb8733a

Browse files
authored
fix-export-of-tables (aws-solutions-library-samples#1317)
1 parent 3155b0d commit cb8733a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cid/export.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,22 @@ def export_analysis(qs, athena, glue):
263263
fields = []
264264
for field in cur_helper.fields:
265265
if field in view_data['data']:
266+
if field == 'data':
267+
# 'data' is a partition of cur2 and a frequent word, so skip it to avoid false positives
268+
continue
266269
fields.append(field)
267270
view_data['dependsOn'][f'cur{cur_helper.version}'] = fields or True
268271
cur_tables.append(dep_view_name)
269272
else:
273+
dep_view_data = all_views_data.get(dep_view_name, {}).get('data', '')
274+
if 'CREATE EXTERNAL TABLE' in dep_view_data and not get_parameters().get('export-tables') == 'yes':
275+
cid_print(f'{key} is a Glue table. Skipping. To export table definitions use `--export-tables yes`. Please manage this dependency by adding parameter')
276+
# TODO: add parameter with schema query
277+
continue
270278
logger.debug(f'{dep_view_name} is not cur')
271279
if dep_view_name not in all_views_data:
272280
logger.debug(f'{dep_view_name} skipping as not in the views list')
273-
if dep_view_name in ['account_map']:
274-
logger.debug(f'{dep_view_name} is a special. skip.')
281+
continue
275282
non_cur_dep_views.append(dep_view_name)
276283
if deps.get('views'):
277284
deps['views'] = non_cur_dep_views

0 commit comments

Comments
 (0)