code: def addBar(self, instrument, bar, frequency):
      instrument = normalize_instrument(instrument)
      instrumentId = self.__getOrCreateInstrument(instrument)
      timeStamp = dt.datetime_to_timestamp(bar.getDateTime())
  
      try:
          sql = "insert into bar (instrument_id, frequency, timestamp, open, high, low, close, volume, adj_close) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"
          params = [
              instrumentId,
              frequency,
              timeStamp,
              bar.getOpen(),
              bar.getHigh(),
              bar.getLow(),
              bar.getClose(),
              bar.getVolume(),
              bar.getAdjClose(),
          ]
          self.__connection.execute(sql, params)
      except sqlite3.IntegrityError:
          sql = (
              "update bar set open = ?, high = ?, low = ?, close = ?, volume = ?, adj_close = ?"
              " where instrument_id = ? and frequency = ? and timestamp = ?"
          )
          params = [
              bar.getOpen(),
              bar.getHigh(),
              bar.getLow(),
              bar.getClose(),
              bar.getVolume(),
              bar.getAdjClose(),
              instrumentId,
              frequency,
              timeStamp,
          ]
          self.__connection.execute(sql, params)
  
imports: from pyalgotrade.barfeed import dbfeed
  from pyalgotrade.barfeed import membf
  from pyalgotrade import bar
  from pyalgotrade.utils import dt
  import sqlite3
  import os
label_desc: Use image node_id 6 for calling the Database obj's underlying member method code with example usage: obj.addBar(instrument, bar, frequency) without return types