Metadata-Version: 2.1
Name: sqlcsv-exporter
Version: 1.0.1
Summary: CLI utility to stream SQL Server query results into CSV files.
License: MIT
Keywords: sql-server,csv,cli,export,pyodbc
Author: Your Team
Author-email: team@example.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Database
Classifier: Topic :: Utilities
Requires-Dist: pyodbc (>=5.0.1)
Requires-Dist: rich (>=13.7.0)
Description-Content-Type: text/markdown

# sqlcsv-exporter

`sqlcsv-exporter` is a publishable CLI package for streaming SQL Server query results into CSV files without loading the full result set into memory.

## Features

- Reads SQL from a `.sql` file
- Rewrites a declared `@InAsOfDate` value when present
- Supports trusted or SQL authentication
- Streams rows with chunked `fetchmany()` and chunked CSV writes
- Shows live Rich progress while the export runs
- Ships with pytest coverage for core behavior

## Install

```bash
poetry install
```

## Run

```bash
poetry run sqlcsv-exporter \
  --sql ./queries/report.sql \
  --output ./exports/report.csv \
  --server my-sql-server \
  --database Reporting
```

With SQL authentication:

```bash
poetry run sqlcsv-exporter \
  --sql ./queries/report.sql \
  --output ./exports/report.csv \
  --server my-sql-server \
  --database Reporting \
  --sql-auth \
  --username reporting_user \
  --password secret
```

Override the as-of date used in a declared `@InAsOfDate` variable:

```bash
poetry run sqlcsv-exporter \
  --sql ./queries/report.sql \
  --output ./exports/report.csv \
  --server my-sql-server \
  --database Reporting \
  --date 2026-03-26
```

## Publish

```bash
poetry build
poetry publish
```

