Upsert a record in a table

def upsert(self, table: str, record: dict, create_cols: bool=False,
               dtypes: list=None, pks=["id"], namefields=["id"]):
        """
        Upsert a record in a table
        """
        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)