def _write_local_schema_file(self, cursor):
schema = []<EOL>for field in cursor.description:<EOL><INDENT>field_name = field[<NUM_LIT:0>].replace('<STR_LIT:U+0020>', '<STR_LIT:_>')  <EOL>field_type = self.type_map(field[<NUM_LIT:1>])<EOL>field_mode = '<STR_LIT>'  <EOL>schema.append({<EOL>'<STR_LIT:name>': field_name,<EOL>'<STR_LIT:type>': field_type,<EOL>'<STR_LIT>': field_mode,<EOL>})<EOL><DEDENT>self.log.info('<STR_LIT>', self.schema_filename, schema)<EOL>tmp_schema_file_handle = NamedTemporaryFile(delete=True)<EOL>s = json.dumps(schema, sort_keys=True)<EOL>s = s.encode('<STR_LIT:utf-8>')<EOL>tmp_schema_file_handle.write(s)<EOL>return {self.schema_filename: tmp_schema_file_handle}<EOL>
Takes a cursor, and writes the BigQuery schema for the results to a
local file system.

:return: A dictionary where key is a filename to be used as an object
    name in GCS, and values are file handles to local files that
    contains the BigQuery schema fields in .json format.