sqlsimtools / sqlpysim
AGENTS.md42 starsChanged 32 days agoMITView on GitHub
This file tells coding agents (GitHub Copilot, Claude Code, Cursor, Aider, Codex CLI, etc.) how to invoke sqlpysim when a user asks them to run SQL workloads from Python. It is shipped at the root of the sqlpysim release package so any agent operating in the user's project picks it up automatically. A companion VS Code skill descriptor lives at ../.github/skills/sqlpysim/SKILL.md. sqlpysim is a Public Preview Python implementation of sqlsim built on Microsoft's native mssql-python driver. It shares sqlsim's core…
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository15 other files it gives its agents.
- sqlsim/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- sqlpysim/.github/copilot-instructions.mdCopilot instructions
- sqlsim/.github/copilot-instructions.mdCopilot instructions
- docs/llms.txtllms.txt
- sqlpysimSkill
- sqlsimSkill
- sqlsimstudio-load-testSkill
- sqlsimstudio-manual-testSkill
- sqlsimstudioSkill
- sqlsimtools-buildSkill
- sqlsimtools-project-statsSkill
- sqlsimtools-releaseSkill
- sqlpysimSkill
- sqlsimSkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 96
Use -T - or -P - with redirected stdin for local applications and automation so the secret does not appear in process arguments.
- Distinctive: line 106
After the first successful connection, progress and completed events also identify the driver version and SQL Server version and edition.
- Distinctive: line 119
Use sqlsim when the application name matters.
- Very specific: line 148
Always include an auth flag (-E, -A, -T, or -U/-P).
- Very specific: line 150
Use -q for stress tests.
- Very specific: line 151
Start with a small -n value, scale gradually, and monitor client and server CPU, memory, network, and connection usage.
- Very specific: line 155
Use -C to trust server cert when working against local SQL Server with a dev cert.
- Very specific: line 157
Do not invent long flags. --help is the only long flag.
- Very specific: line 158
Do not pipe through 2>&1 or Select-String.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — sqlpysim
This file tells coding agents (GitHub Copilot, Claude Code, Cursor, Aider, Codex CLI, etc.) how to invoke sqlpysim when a user asks them to run SQL workloads from Python. It is shipped at the root of the sqlpysim release package so any agent operating in the user's project picks it up automatically.
A companion VS Code skill descriptor lives at
../.github/skills/sqlpysim/SKILL.md.
What sqlpysim is
sqlpysim is a Public Preview Python implementation of sqlsim built on Microsoft's native
mssql-python driver. It shares sqlsim's core query, concurrency,
authentication, and reporting workflow, but some advanced flags and output
fields differ. See ../RELEASE-NOTES.md before treating
the tools as interchangeable.
Use it when:
- The user is in a Python environment and prefers not to ship a C++ binary.
- The user wants to compare native ODBC (
sqlsim) vs.mssql-pythonbehavior. - The user needs the JSON contract for automation but on a non-Windows or
non-x64 environment where
sqlpysimis easier to deploy thansqlsim.exe.
Do not use for absolute-lowest-overhead performance comparisons —
sqlsim (the native binary) is the right tool there.
Installed layout
your-project/
├── .github/skills/sqlpysim/SKILL.md
└── sqlpysim/
├── sqlpysim.py # entry point
├── requirements.txt # mssql-python
├── AGENTS.md # this file
├── LICENSE # MIT license
├── sqlpysim.md # full user manual
└── examples/ # powershell/, sql/, workload/, github-actions-ci/Prerequisites
python -m pip install -r .\sqlpysim\requirements.txtRequires Python 3.10+ and the mssql-python driver.
Entry point
python .\sqlpysim\sqlpysim.py <args>Core query invocations use the same command shape as sqlsim.exe. Do not assume
that advanced flags, validation behavior, or JSON fields are interchangeable;
use this file and the sqlpysim manual for supported syntax.
Canonical patterns
# Local SQL Server, Windows Auth
python .\sqlpysim\sqlpysim.py -S localhost -E -C -Q "SELECT @@VERSION"
# Azure SQL with token
$token = az account get-access-token --resource https://database.windows.net --query accessToken -o tsv
$token | python .\sqlpysim\sqlpysim.py -S myserver.database.windows.net -d mydb -T - -Q "SELECT 1"
# Multi-threaded workload (quiet)
python .\sqlpysim\sqlpysim.py -S localhost -E -C -i .\workload.sql -n 10 -r 100 -q
# JSON output for automation
python .\sqlpysim\sqlpysim.py -S localhost -E -C -i .\workload.sql -n 4 -r 50 -json -o results.json
# sqlsim-compatible per-query statistics
python .\sqlpysim\sqlpysim.py -S localhost -E -C -i .\workload.sql -n 4 -r 50 -querystats -json -q -o results.json
# Mixed workload groups from a sqlsim-format workload file
python .\sqlpysim\sqlpysim.py -S localhost -E -C -workload .\workload.json -q
# Live progress: one JSON event per line on stdout for a supervising process
python .\sqlpysim\sqlpysim.py -S localhost -E -C -Q "SELECT 1" -n 4 -r 500 -stream-json -q
# Live progress plus canonical final JSON
python .\sqlpysim\sqlpysim.py -S localhost -E -C -Q "SELECT 1" -n 4 -r 500 `
-stream-json -json -o final-results.json -q
# Periodic statistics snapshots written while the run is still going
python .\sqlpysim\sqlpysim.py -S localhost -E -C -Q "SELECT 1" -n 4 -r 500 -querystats-interval 5 -querystats-file live.json -q
# Secure password input for local applications and automation
$password | python .\sqlpysim\sqlpysim.py -S localhost -U testuser -P - -Q "SELECT 1"Use -T - or -P - with redirected stdin for local applications and automation so the secret does not appear in process arguments.
-querystats reports the same aggregate fields as sqlsim. It does not query
DMVs or emit query/plan hashes.
-stream-json emits started, one progress per second, and completed,
matching sqlsim's event shape. Combine it with -json -o <file> to retain the
canonical final result while streaming. Counters are cumulative and
throughput_per_second is a running average, so a consumer wanting a current
rate computes deltas between events.
After the first successful connection, progress and completed events also
identify the driver version and SQL Server version and edition.
-querystats-interval <seconds> writes a statistics snapshot to a file while
the run is in progress, implying -querystats and defaulting the path to
querystats-live.json. The file is replaced atomically, so it is always safe
to read. A write failure never interrupts the run; it is reported once on the
normal error channel, which is silent in -json and -stream-json modes, so
in those modes check that the file exists rather than relying on a message.
sqlsim behaves identically.
-app is rejected rather than silently ignored, because mssql-python
reserves the application name and always reports MSSQL-Python to the server.
Use sqlsim when the application name matters.
Driver constraints (do not violate)
These come from mssql-python and an agent generating Python code that
wraps sqlpysim must respect them:
- Reserved keywords — the driver controls these; do not pass in the
connection string:
APP,Application Name. Token auth uses
attrs_before[SQL_COPT_SS_ACCESS_TOKEN]with a UTF-16LE / SQLLEN-prefixed buffer. There is NOaccess_token=parameter.import struct SQL_COPT_SS_ACCESS_TOKEN = 1256 token_bytes = token.encode("utf-16le") token_struct = struct.pack(f"<I{len(token_bytes)}s", len(token_bytes), token_bytes) conn = connect(conn_str, attrs_before={SQL_COPT_SS_ACCESS_TOKEN: token_struct})- Import as:
from mssql_python import connect.
Reference: https://github.com/microsoft/mssql-python.
Authoring rules for agents
Same as sqlsim — see sqlsim/AGENTS.md (or the sqlsim
package's AGENTS.md) for the full list. The key ones:
- Always include an auth flag (
-E,-A,-T, or-U/-P). - For Azure SQL, always include
-d <database>. - Use
-qfor stress tests. - Start with a small
-nvalue, scale gradually, and monitor client and server CPU, memory, network, and connection usage. High thread counts can exhaust client resources and invalidate results; use a dedicated client for significant load tests. - Use
-Cto trust server cert when working against local SQL Server with a dev cert. - Do not invent long flags.
--helpis the only long flag. - Do not pipe through
2>&1orSelect-String. Capture into a variable if you need to parse output.
Help
python .\sqlpysim\sqlpysim.py --helpFull manual: sqlpysim.md (also rendered as sqlpysim.html).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

