Skip to main content

SQLAlchemy plugin for Spotlight.

Project description

Spotlight SQLAlchemy

SQLAlchemy plugin for Spotlight.

Table of Contents


Spotlight SQLAlchemy can be installed via pip:

pip install spotlight-sqlalchemy



from spotlight_sqlalchemy.plugin import SQLAlchemyPlugin


from spotlight.validator import Validator
from spotlight_sqlalchemy.plugin import SQLAlchemyPlugin

rules = {
    "id": "exists:user,id",
    "email": "unique:user,email"

data = {
    "id": 1,
    "email": ""

validator = Validator([SQLAlchemyPlugin(session)])
errors = validator.validate(data, rules)

Available Rules

Warning: You should never pass any user controlled input into the database rules. Otherwise, your application will be vulnerable to an SQL injection attack.

unique (database)

The field under validation must be unique in a given database table. The last 4 fields (ignore column, ignore value, where column, where value) are optional.


exists (database)

The field under validation must exist on a given database table. The last 2 fields (where column, where value) are optional.


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for spotlight-sqlalchemy, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size spotlight_sqlalchemy-1.0.2-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size spotlight-sqlalchemy-1.0.2.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page