Re: [sqlalchemy] Re: Differentiate what raised IntegrityError (fkey not found vs. duplicate pkey)

2018-03-20 Thread Mike Bayer
I can show you where I did something like this for Openstack, which you can use yourself but you need to extricate it from oslo.db, at the very least you can grab the regular expressions right out, if you don't want to use the whole @filters framework:

[sqlalchemy] Re: Differentiate what raised IntegrityError (fkey not found vs. duplicate pkey)

2018-03-20 Thread Jonathan Vanasco
Mike will probably chime in with a more correct answer, but... You should be able to figure that out by catching the `sqlalchemy.exc.IntegrityError` error and inspecting the attributes (original error or the text message).