code: def _insert_data(self, name, value, timestamp, interval, config, **kwargs):
      '''Helper to insert data into sql.'''
      conn = self._client.connect()
      if not self._update_data(name, value, timestamp, interval, config, conn):
        try:
          kwargs = {
            'name'        : name,
            'interval'    : interval,
            'i_time'      : config['i_calc'].to_bucket(timestamp),
            'value'       : value
          }
          if not config['coarse']:
            kwargs['r_time'] = config['r_calc'].to_bucket(timestamp)
          stmt = self._table.insert().values(**kwargs)
          result = conn.execute(stmt)
        except:
          # TODO: only catch IntegrityError
          if not self._update_data(name, value, timestamp, interval, config, conn):
            raisf _insert_data(self, name, value, timestamp, interval, config, **kwargs):
      '''Helper to insert data into sql.'''
      conn = self._client.connect()
      if not self._update_data(name, value, timestamp, interval, config, conn):
        try:
          kwargs = {
            'name'        : name,
            'interval'    : interval,
            'i_time'      : config['i_calc'].to_bucket(timestamp),
            'value'       : value
          }
          if not config['coarse']:
            kwargs['r_time'] = config['r_calc'].to_bucket(timestamp)
          stmt = self._table.insert().values(**kwargs)
          result = conn.execute(stmt)
        except:
          # TODO: only catch IntegrityError
          if not self._update_data(name, value, timestamp, interval, config, conn):
            raise
docs: Helper to insert data into sql.