@reconnecting()<EOL><INDENT>def insert(self, schema, fields, **kwargs):<DEDENT>
r = <NUM_LIT:0><EOL>with self.connection(**kwargs) as connection:<EOL><INDENT>kwargs['<STR_LIT>'] = connection<EOL>try:<EOL><INDENT>with self.transaction(**kwargs):<EOL><INDENT>r = self._insert(schema, fields, **kwargs)<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>exc_info = sys.exc_info()<EOL>if self.handle_error(schema, e, **kwargs):<EOL><INDENT>r = self._insert(schema, fields, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>self.raise_error(e, exc_info)<EOL><DEDENT><DEDENT><DEDENT>return r<EOL>
Persist d into the db

schema -- Schema()
fields -- dict -- the values to persist

return -- int -- the primary key of the row just inserted