Generate safe T-SQL stored-procedure debug harness scripts (analyze + DML previews)
Project description
sql-sp-harness
T-SQL Stored Procedure Debug Harness — turn SQL Server stored procedures into safe, runnable debug scripts you can execute on a pre-production database without writing to real tables.
Not a live debugger. This tool generates a static test harness (DML previews + variable traces), not breakpoints or step-into debugging.
Not affiliated with Microsoft. "SQL Server" and T-SQL are used descriptively only.
What it does
| Command | Purpose |
|---|---|
analyze |
See what keyword elements that procedure contains along with counts — DML, TRY/CATCH, loops, SET, line-level detail |
generate |
Create a debug harness: real-table DML → SELECT previews, PRINT traces on variables |
Output includes a banner on the top of the procedure stating: DEBUG HARNESS — DO NOT RUN ON PRODUCTION.
Install
pip install sql-sp-harness
Requires Python 3.10+.
Verify:
sql-sp-harness version
python -m sql_sp_harness version
Quick start
sql-sp-harness analyze -i MyProc.sql
sql-sp-harness generate -i MyProc.sql -o MyProc_debug.sql
With traces in the Messages tab (default):
sql-sp-harness generate -i MyProc.sql -o MyProc_debug.sql --trace-style print
Development
git clone https://github.com/DeeprajDeveloper/sql-sp-harness.git
cd sql-sp-harness
pip install -e ".[dev]"
pytest
Build for PyPI:
./scripts/publish-pypi.sh
./scripts/publish-pypi.sh upload
Limitations
| Pattern | Behavior |
|---|---|
| Dynamic SQL | Not analyzed |
| Encrypted procedures | No source |
| Cursors | Not rewritten |
| DDL inside proc | Not stubbed |
Always review generated scripts before running on a shared server.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sql_sp_harness-1.0.0.tar.gz.
File metadata
- Download URL: sql_sp_harness-1.0.0.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6f8122a50895f608161903ee9ba0a5b7e1b1fc43a36541181032c1977db7f05
|
|
| MD5 |
5ce70f85ab951927169ad335185179e5
|
|
| BLAKE2b-256 |
01d2e4a172760b3e8e2df7aa5b0540a1919e65940299d843fa8d2a4d59bfdd8a
|
Provenance
The following attestation bundles were made for sql_sp_harness-1.0.0.tar.gz:
Publisher:
publish-pypi.yml on DeeprajDeveloper/sql-sp-harness
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sql_sp_harness-1.0.0.tar.gz -
Subject digest:
b6f8122a50895f608161903ee9ba0a5b7e1b1fc43a36541181032c1977db7f05 - Sigstore transparency entry: 1635471441
- Sigstore integration time:
-
Permalink:
DeeprajDeveloper/sql-sp-harness@416413973a484bbdce768b772d450cb82f70bce0 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/DeeprajDeveloper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@416413973a484bbdce768b772d450cb82f70bce0 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file sql_sp_harness-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sql_sp_harness-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bfd59e1c2299152d0193bf438f66c39f446ff59a0ebf275c7925f540980b902
|
|
| MD5 |
1ee011bad5969f96e9ca1ff752ecf379
|
|
| BLAKE2b-256 |
bb970ab1cae54837961044ef5222b790aad7503d607da84b5a8b74c794464d83
|
Provenance
The following attestation bundles were made for sql_sp_harness-1.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on DeeprajDeveloper/sql-sp-harness
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sql_sp_harness-1.0.0-py3-none-any.whl -
Subject digest:
6bfd59e1c2299152d0193bf438f66c39f446ff59a0ebf275c7925f540980b902 - Sigstore transparency entry: 1635471447
- Sigstore integration time:
-
Permalink:
DeeprajDeveloper/sql-sp-harness@416413973a484bbdce768b772d450cb82f70bce0 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/DeeprajDeveloper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@416413973a484bbdce768b772d450cb82f70bce0 -
Trigger Event:
workflow_dispatch
-
Statement type: