in flex-templates/python/regional_dlp_transform/bigquery_dlp_bigquery.py [0:0]
def from_table_to_list_dict(content_item):
"""
Converts a DLP API v2 ContentItem of type Table with a single row
to a Python dict object.
See:
- https://cloud.google.com/dlp/docs/reference/rest/v2/ContentItem#Table
- https://cloud.google.com/dlp/docs/inspecting-structured-text
"""
result = []
for row in content_item.table.rows:
new_item = {}
for index, val in enumerate(content_item.table.headers):
new_item[val.name] = row.values[index].string_value
result.append(new_item)
return result