def _insert(self, schema, fields, **kwargs):
field_formats = []<EOL>field_names = []<EOL>query_vals = []<EOL>for field_name, field_val in fields.items():<EOL><INDENT>field_names.append(self._normalize_name(field_name))<EOL>field_formats.append(self.val_placeholder)<EOL>query_vals.append(field_val)<EOL><DEDENT>query_str = "<STR_LIT>".format(<EOL>self._normalize_table_name(schema),<EOL>'<STR_LIT:U+002CU+0020>'.join(field_names),<EOL>'<STR_LIT:U+002CU+0020>'.join(field_formats)<EOL>)<EOL>ret = self._query(query_str, query_vals, cursor_result=True, **kwargs)<EOL>pk_name = schema.pk.name<EOL>return ret.lastrowid if pk_name not in fields else fields[pk_name]<EOL>
http://www.sqlite.org/lang_insert.html