Re: [sqlalchemy] Re: Differentiate what raised IntegrityError (fkey not found vs. duplicate pkey)
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)
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).