google.cloud.forseti.common.data_access.csv_writer module

Writes the csv files for upload to Cloud SQL.

normalize_nested_dicts(row)[source]

Transform nested dicts into json strings with sorted keys.

Parameters:row (dict) – A dictionary to normalize.
Returns:A row with nested dicts transformed to json string.
Return type:dict
write_csv(*args, **kwds)[source]

Start the csv writing flow.

Parameters:
  • resource_name (str) – The resource name.
  • data (iterable) – An iterable of data to be written to csv.
  • write_header (bool) – If True, write the header in the csv file.
Yields:

object – The CSV temporary file pointer.

Raises:

CSVFileError – If there was an error writing the CSV file.