On Sunday 03 January 2016 04:20 AM, Mike Bayer wrote:

On 01/02/2016 01:02 PM, Krishnakant wrote:
hello all,
I wish to know how I can pick up the constraint failure errors in my code?
I think I would probably have to pick up the errors in a try: except:
system?
that is correct.

But What is the exact way of picking up the message?
You'd need to catch the type of exception, such as IntegrityError which
is usually what you will get for a constraint violation.  Beyond that,
if you need to programmatically have more information you'd need to
parse the text of the exception with a regular expression.

So If the unique constraint is violated, then will I still have to see them using integrity exception?

As I said I am using psycopg2 for postgresql.
Thanks for the tips.
happy hacking.
Krishnakant.

--
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to