small-expectations
Simple SQL-based expectations runner.
Install
pip install small-expectations
Usage
Create smallex.toml:
[database]
engine = "sqlite"
[database.connection]
database = "example.db"
Supported engines:
sqlitesnowflakedatabricks
Example snowflake config:
[database]
engine = "snowflake"
[database.connection]
account = "my-account"
user = "my-user"
password = "my-password"
warehouse = "my-warehouse"
database = "my-database"
schema = "public"
Example databricks config:
[database]
engine = "databricks"
[database.connection]
server_hostname = "adb-1234567890123456.7.azuredatabricks.net"
http_path = "/sql/1.0/warehouses/abc123"
access_token = "dapi..."
Add SQL files under tests/:
SELECT * FROM users WHERE email IS NULL;
You can define multiple tests in one SQL file with metadata comments:
-- smallex:test: no_null_emails
-- smallex:message: users.email should never be null
SELECT id, email
FROM users
WHERE email IS NULL;
-- smallex:test: no_duplicate_emails
-- smallex:message: users.email should be unique
SELECT email, COUNT(*) AS duplicates
FROM users
WHERE email IS NOT NULL
GROUP BY email
HAVING COUNT(*) > 1;
Metadata markers:
-- smallex:test: <name>: logical test name (used in output asfile.sql::<name>).-- smallex:message: <message>: failure message shown in terminal summary and failure details.
Run:
smallex run
Show command help:
smallex run --help
A test passes when the query returns zero rows and fails if it returns one or more rows.
The terminal report follows a pytest-like style (session header, per-test ./F,
failure details, and short summary info).
Failure rows output
By default, failing rows are not printed or exported.
You can configure this behavior:
smallex run \
--failure-rows-mode terminal \
--failure-rows-limit 5
smallex run \
--failure-rows-mode csv \
--failure-rows-csv-limit 10000 \
--failure-rows-dir .smallex/failures
smallex run \
--failure-rows-mode both \
--failure-rows-limit 5 \
--failure-rows-csv-limit 10000
Options:
--config: path to TOML config file (default:smallex.toml)--tests-dir: root folder containing.sqltest files (default:tests)--color:auto | yes | no(default:auto)--failure-rows-mode:none | terminal | csv | both(default:none)--failure-rows-limit: top rows shown in terminal per failing test (default:5)--failure-rows-csv-limit: max rows written to CSV per failing test (default:10000)--failure-rows-dir: output directory for CSV files (default:.smallex/failures)
Testing
The test suite includes:
- CLI + SQLite integration tests using a temporary local database.
- Backend unit tests that mock Snowflake and Databricks connectors so no real cloud connections are required.
Documentation
This repository uses MkDocs + Material.
Run docs locally:
pip install ".[docs]"
mkdocs serve
Build static docs:
mkdocs build
GitHub Pages is deployed automatically from .github/workflows/docs.yml on pushes to main.
Metadata
Release files for small-expectations 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| small_expectations-0.2.2.tar.gz | 21.9 kB | Without provenance | Details for small_expectations-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| small_expectations-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for small_expectations-0.2.2-py3-none-any.whl |
Total release size: 44.1 kB
Release files / small_expectations-0.2.2.tar.gz
| Download URL | small_expectations-0.2.2.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e6665fdd6d61cbf6bba21d33b6c09fb5afb7074db26095c89a1b5fcc184c1b4
|
|
BLAKE2b-256 checksum How to use checksums |
ba0e04a794ad19ac3f2df5a95b31ecb3ce481ff6779c8f2ec4ce21e1f333454d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / small_expectations-0.2.2-py3-none-any.whl
| Download URL | small_expectations-0.2.2-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9320478cca6c3f09ea21d26760de3be99499f7b86e77eadd90ab95dca128b016
|
|
BLAKE2b-256 checksum How to use checksums |
523ec25736555e490f2128406adc4c30f9a6ee777dec062f9b96cd11befa1bda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for small-expectations 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.