in tools/cloud_functions/bq_table_snapshots/bq_backup_fetch_tables_names/main.py [0:0]
def filter_tables(tables, request_json):
tables_to_include_list = request_json.get("tables_to_include_list", [])
tables_to_exclude_list = request_json.get("tables_to_exclude_list", [])
tables = [x for x in tables if x.table_type == TABLE_TYPE_PHYSICAL_TABLE]
if len(tables_to_include_list) > 0:
tables = [x for x in tables if x.table_id in tables_to_include_list]
if len(tables_to_exclude_list) > 0:
tables = [x for x in tables if x.table_id not in tables_to_exclude_list]
tables = [f"{x.project}.{x.dataset_id}.{x.table_id}" for x in tables]
return tables