I get the following error: sqlalchemy.exc.IntegrityError: (IntegrityError) column id is not unique u'INSERT INTO candidates (id, "timeStamp", name, link) VALUES (?, ?, ?, ?)' (u'ORaE9+aCdP0', '2015-02-16 18: 19:58.000000', u'Kunal Sethi', u'https://gambit.mycompas.com/staff/apptracedit.aspx?enc=1&ID=ORaE9+aCdP0=&bk=reqmgr&rsbk=1&stat=')
The code is as follows: def updateCandidateTable(self, candidates): session = self.Session() for candidate in candidates: print "candidate in updateCandtable param: ", candidate.name # Notes: # Maybe the first call needs merge, but the # following ones are updating and I need an update? try: session.add(candidate) session.commit() except: raise Help, I am fairly new to mysql alchemy. I just need to add and update candidates, but have no clue how can the column ID is not unique, since the code fails on the first insert. Someone suggested that I call the code below, but then only the first candidate was entered and the rest were skipped. for record in records: try: with session.begin_nested(): session.merge(record) except: print "Skipped record %s" % recordsession.commit() -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.