Re: [sqlalchemy] duplicate key trick

2012-01-22 Thread Alex K
Thanks! Great work! :) On Sat, Jan 21, 2012 at 3:18 AM, Conor wrote: > > > def get_constraint_name(e): ># Unique constraint violations in PostgreSQL have error code 23505. >if e.orig.pgcode == "23505": >return re.search(r'^ERROR: duplicate key value violates unique > constraint

Re: [sqlalchemy] duplicate key trick

2012-01-20 Thread Conor
On 01/20/2012 10:42 AM, lestat wrote: > Hi! > > Maybe anyone can tell how I can except this error? > > > class TmpTest(db.Model, UnicodeMixin): > __tablename__ = 'tmp_test' > > id = db.Column(db.Integer, primary_key=True) > name = db.Column(db.String(50), nullable=False, unique=True) >

[sqlalchemy] duplicate key trick

2012-01-20 Thread lestat
Hi! Maybe anyone can tell how I can except this error? class TmpTest(db.Model, UnicodeMixin): __tablename__ = 'tmp_test' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), nullable=False, unique=True) count = db.Column(db.Integer, nullable=False, defaul