(20210317Solved) Catch the IntegrityError about PostgreSQL in Python
Overview通过python api向postgresql存入数据出现重复数据,会报错IntegrityError,如何捕捉?Solution通过sqlalchemy使用Python API。The sqlalchemy wraps the psycopg2 exception to its own exception.from sqlalchemy.exc import IntegrityErrortry: ...except IntegrityError as e: ..
复制链接