Skip to main content

sqlite-column-sentry

PyPI version License: MIT Downloads LinkedIn

sqlite-column-sentry is a lightweight Python package that helps developers validate SQLite queries for column‑related safety issues. It analyzes a user‑provided SQL statement and returns structured feedback about missing columns, incorrect data types, unsafe references, and more. The package leverages LLM7 (via langchain_llm7) and llmatch‑messages to provide clear, actionable suggestions, catching potential runtime errors before they happen.


Installation

pip install sqlite_column_sentry

Quick Start

from sqlite_column_sentry import sqlite_column_sentry

# Simple usage with the default LLM7 backend
sql = "SELECT name, age FROM users WHERE id = ?;"
issues = sqlite_column_sentry(user_input=sql)

print(issues)
# Example output: ['Column "age" may be NULLable but is used in a NOT NULL context']

Parameters

Parameter Type Description
user_input str The SQLite query you want to validate.
llm Optional[BaseChatModel] A LangChain LLM instance. If omitted, the package creates a default ChatLLM7 instance.
api_key Optional[str] API key for LLM7. If omitted, the function reads LLM7_API_KEY from the environment (or falls back to a placeholder).

Using a Custom LLM

You can plug any LangChain‑compatible LLM that follows the BaseChatModel interface.

OpenAI

from langchain_openai import ChatOpenAI
from sqlite_column_sentry import sqlite_column_sentry

llm = ChatOpenAI()
issues = sqlite_column_sentry(user_input="SELECT * FROM products;", llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from sqlite_column_sentry import sqlite_column_sentry

llm = ChatAnthropic()
issues = sqlite_column_sentry(user_input="INSERT INTO orders (id, amount) VALUES (1, 100);", llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from sqlite_column_sentry import sqlite_column_sentry

llm = ChatGoogleGenerativeAI()
issues = sqlite_column_sentry(user_input="UPDATE accounts SET balance = balance - 10 WHERE id = 5;", llm=llm)

LLM7 Default Configuration

  • The package uses ChatLLM7 from the langchain_llm7 package by default.
  • Free‑tier LLM7 rate limits are sufficient for most development workflows.
  • To increase limits, provide your own API key:
    issues = sqlite_column_sentry(
        user_input="SELECT * FROM logs;",
        api_key="YOUR_LLM7_API_KEY"
    )
    
  • Obtain a free API key by registering at https://token.llm7.io/.

Contributing

Contributions, bug reports, and feature requests are welcome! Please open an issue or submit a pull request on the GitHub repository.


License

This project is licensed under the MIT License.


Author

Eugene Evstafev
📧 Email: hi@eugene.plus
🐙 GitHub: chigwell


Repository & Issues

Metadata

Release files for sqlite-column-sentry 2025.12.21152531

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlite-column-sentry 2025.12.21152531
File Size Uploaded
sqlite_column_sentry-2025.12.21152531.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqlite-column-sentry 2025.12.21152531
File Interpreter ABI Platform
sqlite_column_sentry-2025.12.21152531-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / sqlite_column_sentry-2025.12.21152531.tar.gz

Download URL sqlite_column_sentry-2025.12.21152531.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
84861d04e7f798b1cd4ce241213a063c69ce2df3c39438c5f182e3503a8d60d1
BLAKE2b-256 checksum
How to use checksums
d5d2a9b9db604d3cd80293b1324c43b2b6d976b032bef8121d53827f2fb1a02d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / sqlite_column_sentry-2025.12.21152531-py3-none-any.whl

Download URL sqlite_column_sentry-2025.12.21152531-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
556ed70490b631cc1bbe5329f5d71130b5beac9cc385e7736616c3de67d4c195
BLAKE2b-256 checksum
How to use checksums
02005906030c3398d9a97c6c143e2790218cacdda280fa69e0d5cdde03be8c47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.21152531 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page