'Convert Exported* rdfvalue into a BigQuery schema.'

def RDFValueToBigQuerySchema(self, value):

    fields_array = []
    for type_info in value.__class__.type_infos:
        if (type_info.__class__.__name__ == 'ProtoEmbedded'):
            fields_array.append({'name': type_info.name, 'type': 'RECORD', 'description': type_info.description, 'fields': self.RDFValueToBigQuerySchema(value.Get(type_info.name))})
        else:
            bq_type = (self.RDF_BIGQUERY_TYPE_MAP.get(type_info.proto_type_name, None) or 'STRING')
            if hasattr(type_info, 'original_proto_type_name'):
                if (type_info.original_proto_type_name in ['RDFDatetime', 'RDFDatetimeSeconds']):
                    bq_type = 'TIMESTAMP'
                elif (type_info.proto_type_name == 'uint64'):
                    bq_type = 'STRING'
            fields_array.append({'name': type_info.name, 'type': bq_type, 'description': type_info.description})
    return fields_array
