sqlalchemy.exc IntegrityError Example Code

IntegrityError is a class within the sqlalchemy.exc module of the SQLAlchemy project.

ArgumentError, DataError, DatabaseError, InvalidRequestError, NoInspectionAvailable, NoSuchTableError, OperationalError, ProgrammingError, and UnsupportedCompilationError are several other callables with code examples from the same sqlalchemy.exc package.

Example 1 from CTFd

CTFd (homepage) is a capture the flag (CTF) hacking web app built with SQLAlchemy and Flask. The application can be used as-is to run CTF events, or the code can be modified for custom rules on hacking scenarios. CTFd is open sourced under the Apache License 2.0.

CTFd / CTFd / views.py

Example 2 from flask-base

flask-base (project documentation) provides boilerplate code for new Flask web apps. The purpose of the boilerplate is to stitch together disparate libraries that are commonly used in Flask projects, such as Redis for fast caching and transient data storage, SendGrid for transactional email, SQLAlchemy for persistent data storage through a relational database backend, Flask-WTF for form handling and many others.

flask-base is provided as open source under the MIT license.

flask-base / app / models / user.py

Example 3 from sqlalchemy-utils

sqlalchemy-utils (project documentation and PyPI package information) is a code library with various helper functions and new data types that make it easier to use SQLAlchemy when building projects that involve more specific storage requirements such as currency. The wide array of data types includes ranged values and aggregated attributes.

sqlalchemy-utils / sqlalchemy_utils / asserts.py