def convert_descriptor(self, descriptor):
<EOL>fields = []<EOL>fallbacks = []<EOL>schema = tableschema.Schema(descriptor)<EOL>for index, field in enumerate(schema.fields):<EOL><INDENT>converted_type = self.convert_type(field.type)<EOL>if not converted_type:<EOL><INDENT>converted_type = '<STR_LIT>'<EOL>fallbacks.append(index)<EOL><DEDENT>mode = '<STR_LIT>'<EOL>if field.required:<EOL><INDENT>mode = '<STR_LIT>'<EOL><DEDENT>fields.append({<EOL>'<STR_LIT:name>': _slugify_field_name(field.name),<EOL>'<STR_LIT:type>': converted_type,<EOL>'<STR_LIT>': mode,<EOL>})<EOL><DEDENT>converted_descriptor = {<EOL>'<STR_LIT>': fields,<EOL>}<EOL>return (converted_descriptor, fallbacks)<EOL>
Convert descriptor to BigQuery