code: def upsert(self, table: str, record: dict, create_cols: bool=False,
                 dtypes: list=None, pks=["id"], namefields=["id"]):
          
          try:
              self.db[table].upsert(record, pks, create_cols, dtypes)
          except Exception as e:
              self.err(e, "Can not upsert data")
              return
          names = ""
          for el in namefields:
              names += " " + record[el]
          self.ok("Upserted record"+names)
docs: Upsert a record in a table