Atlas project production

mssql_query_to_csv

The **MSSQL Query to CSV** program is a command-line tool written in Rust that connects to a Microsoft SQL Server database, executes a SQL query, and exports the results to a CSV file. It supports configurable delimiters, quote characters, header inclusion, and command-line overrides for flexibility. It ingests TOML config, SQL Server via ODBC DSN and produces CSV output file.

Type
Field Tool
Lifecycle
Maintenance
Last touched
2025-02-10
Visibility
Public

Purpose

The **MSSQL Query to CSV** program is a command-line tool written in Rust that connects to a Microsoft SQL Server database, executes a SQL query, and exports the results to a CSV file. It supports configurable delimiters, quote characters, header inclusion, and command-line overrides for flexibility.

Current state

Last touched: 2025-02-10. Functionality and completeness: Single-query export is implemented; retries and tests are not documented.

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 Server via ODBC DSN
  • Configuration files (TOML)
  • SQL query text
Outputs
  • CSV output file
  • CSV files

Reality to Action trace

Reality Ingestion

Contributes in this stage.

Canonical Storage

Contributes in this stage.

Automation Engines

Not in scope.

Human Interfaces

Contributes in this stage.

Operational Adoption

Contributes in this stage.

Core workflow

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

Operational notes

Constraints and scars

  • Limited to SQL Server via ODBC; requires local ODBC driver configuration.

Reliability posture

Failure modes and safe behavior: ODBC connection failures or SQL errors abort the run without writing partial output. Idempotency / retries / batching behavior: Re-running overwrites the output file; no built-in retries.

Observability

  • Metrics/health checks: None documented
  • Logs: stdout/stderr from CLI; no structured logging noted in README.

Security and privacy

Config files contain credentials; restrict access and avoid committing them.

Dependencies

Upstream
  • Microsoft SQL Server via ODBC

Ownership

Owners

Josh Barton

Users

Josh Barton (owner)

mssql_query_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, ODBC query execution, CSV writer with configurable delimiters and quoting

Setup / Build / Run

  • Build system(s): Cargo.
  • Install Rust, UnixODBC, and the Microsoft ODBC driver for SQL Server.
  • Configure odbcinst.ini / odbc.ini, then create a config.toml with DSN and SQL.
  • Build with Cargo and run mssql_query_to_csv --config config.toml.