The row it fails on is almost a duplicate of a previous row, the only difference being the integer obj_id. One thing I noticed is the obj_id isn't being passed around strictly as an integer; the metadata associated with that object's id (object name, class, etc...) are being passed around along with it. This wasn't a problem when inserting using the ORM, but could it be causing the problem now?
On Friday, March 13, 2015 at 1:34:07 PM UTC-4, Simon King wrote: > > OK, if it's failing when you insert the rows one-by-one, then you > should be able to see exactly which row it is failing on and you can > start digging in to your database to find out why. After it has > failed, try running the failing statement by hand. > > Are your database columns wide enough? I think MySQL might truncate > strings if they are too long for the column, so 2 strings that you > thought were unique might end up being duplicates due to truncation. > > Simon > > On Fri, Mar 13, 2015 at 5:21 PM, Adam Watson <adamcw...@gmail.com > <javascript:>> wrote: > > I spoke way too soon, using the setup you suggested Simon throws the > same > > error unfortunately. > > > > > > On Friday, March 13, 2015 at 1:13:44 PM UTC-4, Adam Watson wrote: > >> > >> I'm positive the tables are empty when I run it. I run a query to empty > >> the database in MySQL Workbench before every time I run the inserts. > >> > >> Inserting each item separately seems to have worked, but I'll have to > time > >> it again to make sure it actually sped up. Thank you! > >> > >> On Friday, March 13, 2015 at 12:13:24 PM UTC-4, Simon King wrote: > >>> > >>> On Fri, Mar 13, 2015 at 3:45 PM, Adam Watson <adamcw...@gmail.com> > wrote: > >>> > I recently posted a question on stack overflow regarding an > Integrity > >>> > Error > >>> > when using sqlalchemy core. I'd really appreciate it if anyone could > >>> > read it > >>> > and help me figure it out: > >>> > > >>> > > http://stackoverflow.com/questions/29036357/sqlalchemy-core-integrity-error > >>> > > >>> > >>> First, are you sure the table is empty before you start? Entries from > >>> previous import attempts might trigger this error. > >>> > >>> Second, what happens if you insert each row separately? ie. > >>> > >>> insert = Attributes.__table__.insert() > >>> for attr in attrList: > >>> stmt = insert.values({{'obj_id' : attr['obj_id'], ...}) > >>> self.engine.execute(stmt) > >>> > >>> Simon > > > > -- > > 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+...@googlegroups.com <javascript:>. > > To post to this group, send email to sqlal...@googlegroups.com > <javascript:>. > > Visit this group at http://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > -- 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.