ops sling
Sling database operations and queries. Sling is used to query SQL Server (CieTrade, Azure SQL) databases. Results stream directly to the terminal.
Subcommands
| Subcommand | Description |
|---|---|
test | Test database connectivity |
query | Execute an ad-hoc SQL query |
status | Show database status with table row counts |
count | Count rows in a table |
schema | Show table schema (columns, types) |
discover | List tables in a schema |
preset | Run a preset query by name |
Examples
SQL Server Caveats
Sling wraps SQL in a subquery before sending it to SQL Server. A bare ORDER BY without TOP N is silently rejected — the query returns exit code 1 with empty results and no error message. Always pair ORDER BY with TOP N when querying SQL Server.
-- ❌ Fails silently on SQL Server
SELECT * FROM cietrade.accounts ORDER BY created_at DESC
-- ✅ Works correctly
SELECT TOP 100 * FROM cietrade.accounts ORDER BY created_at DESC
Common Workflows
Connectivity Check
Run ops sling test first whenever a query misbehaves — rules out auth and network issues.
Schema Discovery
ops sling discover + ops sling schema together let you explore an unfamiliar database fast.
Row Audits
ops sling count is the fastest way to verify a sync landed the expected number of rows.
Preset Queries
Frequently-used queries can be saved as presets and invoked via ops sling preset <name>.
SQL queries with double quotes, backticks, or $ characters may interact badly with your shell. When in doubt, wrap the query in single quotes or escape carefully.