[sqlalchemy] RE: Anticipating an IntegrityError before it happens (or noticing it immediately after)

2012-01-22 Thread Jackson, Cameron
So I figured out that I can do this: try: self.session.delete(row) self.session.flush() except sqlalchemy.exc.IntegrityError: print Can't do that! But that really isn't a lot of help, because I'm now stuck with a useless transaction. If the user makes a bunch of

Re: [sqlalchemy] RE: Anticipating an IntegrityError before it happens (or noticing it immediately after)

2012-01-22 Thread Michael Bayer
On Jan 22, 2012, at 8:21 PM, Jackson, Cameron wrote: So I figured out that I can do this: try: self.session.delete(row) self.session.flush() except sqlalchemy.exc.IntegrityError: print Can't do that! But that really isn't a lot of help, because I'm now stuck