Skip to main content

CLI utility to stream SQL Server query results into CSV files.

Project description

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

poetry install

Run

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

With SQL authentication:

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:

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

Publish

poetry build
poetry publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlcsv_exporter-1.0.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlcsv_exporter-1.0.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file sqlcsv_exporter-1.0.1.tar.gz.

File metadata

  • Download URL: sqlcsv_exporter-1.0.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.7 Windows/11

File hashes

Hashes for sqlcsv_exporter-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3e1fabdcec939d47f22c5c990beb6e6965cf56a35493e657799227d93a5ffada
MD5 fdb147e8cde954a0d32d71d618fa71a6
BLAKE2b-256 148106e4d9b022c5f47e71185950720b7a4924dd85690f4eeb5a411a93890ed5

See more details on using hashes here.

File details

Details for the file sqlcsv_exporter-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sqlcsv_exporter-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.7 Windows/11

File hashes

Hashes for sqlcsv_exporter-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 047ce3ba353fd865f3aa82f312c92263e2974c468e2a621587b9a258d2bfa857
MD5 929cb5c5584d7d2f7df82566b7eb7bf8
BLAKE2b-256 d921f7d19a486f09e19b5e8cdb294a722ab8b7258ca655a307cab9fe21ee53c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page