Atlas project production

mssql_to_csv

Run SQL files against MSSQL and export results to CSV, optionally through an SSH tunnel. It ingests TOML config, SQL file, MSSQL database and produces CSV output file.

Type
Field Tool
Lifecycle
Maintenance
Last touched
2025-04-25
Visibility
Public

Purpose

Run SQL files against MSSQL and export results to CSV, optionally through an SSH tunnel.

Current state

Last touched: 2025-04-25. Functionality and completeness: Core export flow is implemented; documentation and tests are pending.

Next step

Add baseline automated tests to cover critical flows; Add CI pipeline for build/test/lint; Document deployment/runtime environment (or add Dockerfile); Document interfaces (CLI flags, API endpoints, file formats); Add structured logging and basic health checks.

Interfaces

Inputs
  • TOML config, SQL file, MSSQL database
  • Configuration files (TOML)
  • SQL query file
Outputs
  • CSV output file
  • Query results (reports/extracts)
  • CSV files

Reality to Action trace

Reality Ingestion

Not in scope.

Canonical Storage

Contributes in this stage.

Automation Engines

Not in scope.

Human Interfaces

Not in scope.

Operational Adoption

Not in scope.

Core workflow

TBD. Document the 5-10 steps that define the core workflow.

Artifacts

  • CSV column headers derive from query result columns

Operational notes

Constraints and scars

  • Requires direct DB connectivity or SSH tunnel; no built-in retry/transaction controls.

Reliability posture

Failure modes and safe behavior: SSH or DB connection failures abort run; partial CSV may be written if failure occurs mid-stream. Idempotency / retries / batching behavior: Re-running overwrites output file; no automatic retries.

Observability

  • Logs: Rust logging framework detected (log/tracing/env_logger).
  • Metrics/health checks: None documented
  • Logs: tracing logs to stdout (connection, execution, export, SSH tunnel lifecycle).

Security and privacy

Config contains DB and SSH credentials; secure storage and file permissions are required.

Dependencies

Upstream
  • Microsoft SQL Server
  • optional SSH tunnel via local `ssh` binary

Ownership

Owners

Josh Barton

Users

Josh Barton (owner)

mssql_to_csv

Architecture & Major Components

  • High-level diagram (text):

    • Entry/trigger -> core logic -> outputs (details per docs below)
  • Entry points: src/main.rs

  • Top-level folders: src

  • Key abstractions: Config parsing, optional SSH tunnel bootstrap, query execution, CSV writer with delimiter/quote options

Setup / Build / Run

  • Build system(s): Cargo.
  • Provide a config.toml with database and query paths; run the CLI for exports.