agentleFS
MicrosoftKnown publishermicrosoft/sqlsimtools/sqlpysim/.github/copilot-instructions.md

sqlsimtools / sqlpysim

Copilot instructions42 starsChanged 32 days agoMITView on GitHub

sqlpysim is a Public Preview Python implementation of sqlsim - a SQL workload simulator using Microsoft's native mssql-python driver. It shares the core query, concurrency, authentication, and reporting workflow with sqlsim, but does not yet implement every option or an identical output schema. See ../RELEASE-NOTES.md for the current compatibility gaps. ## CRITICAL: mssql-python Driver Reference ALWAYS consult the official mssql-python documentation before making connection or driver changes: - GitHub: https://github.com/microsoft/mssql-python - PyPI: https://pypi.org/project/mssql-python/ Do NOT use access_token= parameter - it…

  • Reads credentials
  • Installs packages

The file

We split this copilot-instructions.md into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Token authentication: Use attrs_before with SQL_COPT_SS_ACCESS_TOKEN:

    line 22
  2. Very specific:

    Do NOT: use access_token= parameter - it doesn't exist!

    line 29
  3. Distinctive:

    Do not append diagnostic or output redirection to tool commands:

    line 33
  4. Very specific:

    Do not use 2>&1, > file, or | Select-String.

    line 35
  5. Very specific:

    When adding a live test, build its arguments from the suite's auth arguments and launch sqlpysim through the suite's launcher (& …

    line 90
  6. Very specific:

    Missing -C for localhost: - Use -C to trust self-signed certs

    line 129
  7. Very specific:

    Missing authentication: - Always specify -E, -A, -T, or -U/-P

    line 131

≈ “Common” is an estimate: at least 1 in 5 of the 3,779 Copilot instructions 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions for sqlpysim

Project Purpose

sqlpysim is a Public Preview Python implementation of sqlsim - a SQL workload simulator using Microsoft's native mssql-python driver. It shares the core query, concurrency, authentication, and reporting workflow with sqlsim, but does not yet implement every option or an identical output schema. See ../RELEASE-NOTES.md for the current compatibility gaps.

CRITICAL: mssql-python Driver Reference

ALWAYS consult the official mssql-python documentation before making connection or driver changes:

Key Driver Constraints

  • Import as: from mssql_python import connect
  • Reserved keywords (driver-controlled, cannot be set by user):
    • APP / Application Name - driver sets this automatically
  • Supported connection string keywords:
    • Server, Database, Trusted_Connection, UID, PWD
    • Authentication (ActiveDirectoryInteractive, ActiveDirectoryMsi, etc.)
    • Encrypt, TrustServerCertificate
    • ApplicationIntent (ReadOnly, ReadWrite)
    • MultiSubnetFailover
  • Token authentication: Use attrs_before with SQL_COPT_SS_ACCESS_TOKEN:
    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})
    Do NOT use access_token= parameter - it doesn't exist!

Terminal Command Guidelines

Do not append diagnostic or output redirection to tool commands:

  • Do not use 2>&1, > file, or | Select-String.
  • Capture output directly or with a PowerShell variable: $result = command.

The only approved exception is the documented secret-input pattern: use -P - or -T - with standard input when supported. Never echo, log, display, or persist the secret, and never place passwords or tokens in process arguments.

Running sqlpysim

# SQL Server (Windows Auth)
python sqlpysim.py -S localhost -E -C -Q "SELECT 1"

# Azure SQL (Token Auth)
$token = az account get-access-token --resource https://database.windows.net --query accessToken -o tsv
$token | python sqlpysim.py -S server.database.windows.net -d mydb -T - -Q "SELECT 1"

# Multi-threaded workload
python sqlpysim.py -S localhost -E -C -Q "SELECT 1" -n 10 -r 100 -q

Key Parameters

ParameterDescription
-S <server>Server name (defaults to localhost)
-d <database>Database name (optional)
-EWindows Authentication
-AMicrosoft Entra (interactive)
-T <token>Access token
-U/-PSQL Authentication
-Q <query>Query string
-i <file>Input file with queries
-n <threads>Concurrent threads (default: 1)
-r <iterations>Iterations per thread (default: 1)
-vVerbose mode
-qQuiet mode (suppress results)
-jsonJSON output
-CTrust server certificate
-R <intent>Application intent (readonly/readwrite)

Testing

# Quick validation
.\smoke-test.ps1

# Comprehensive testing
.\full-test-suite.ps1

# Check prerequisites
python --version
python -c "import mssql_python"

When adding a live test, build its arguments from the suite's auth arguments and launch sqlpysim through the suite's launcher (& $runSqlPySim or Invoke-SqlPySim in PowerShell, with_secret in Bash). The launcher hands the token or password over on stdin; calling python sqlpysim.py directly with the auth arguments fails, because -T - expects the secret on stdin. Add the test to the PowerShell and Bash suites together; scripts/check-suite-parity.ps1 checks.

Output Format

sqlpysim follows sqlsim's general output conventions, with documented schema and metrics differences:

  • Timestamps: YYYY-MM-DD HH:MM:SS.mmm | message
  • Metrics: Total runtime, batches, min/max/avg times
  • Verbose: 5 phases with P50/P95/P99 percentiles
  • JSON: Structured with version, configuration, metrics, errors, success

Dependencies

  • Python 3.10+
  • mssql-python driver (pip install mssql-python)

File Structure

sqlpysim/
├── sqlpysim.py          # Main single-file implementation
├── README.md            # Quick start guide
├── BUILD.md             # Installation instructions
├── SETUP.md             # Developer setup
├── requirements.txt     # pip dependencies
├── setup.py             # pip install support
├── smoke-test.ps1       # Quick validation
├── full-test-suite.ps1  # Comprehensive tests
├── LICENSE
└── examples/            # powershell/, sql/, workload/, github-actions-ci/

Common Mistakes

  1. Missing -C for localhost - Use -C to trust self-signed certs
  2. Wrong module name - It's mssql-python not mssql
  3. Missing authentication - Always specify -E, -A, -T, or -U/-P

Reference

For complete sqlsim documentation: ../sqlsim/sqlsim.md

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.