sqlxport
Modular CLI + API tool to extract data from PostgreSQL, Redshift, SQLite (and more), exporting to formats like Parquet/CSV, with optional S3 upload and Athena integration.
✅ Features
- 🔄 Run custom SQL queries against PostgreSQL, Redshift, SQLite
- 📦 Export to Parquet or CSV (
--format) - 🩣 Upload results to S3 or MinIO
- 🔄 Redshift
UNLOADsupport (--export-mode redshift-unload) - 🧹 Partition output by column
- 📜 Generate Athena
CREATE TABLEDDL - 🔍 Preview local or remote Parquet/CSV files
- ⚙️
.envsupport for convenient config - 🐍 Reusable Python API
❓ Why SQLxport?
SQLxport simplifies data export workflows and is designed for automation:
- ✅ One command gives you SQL → Parquet/CSV → S3
- 🧱 Works locally, in CI, or inside Docker
- 🪢 Connects to Athena, MinIO, Redshift easily
- 🔌 Clean format and database plugin model
- 🧪 Fully tested, scriptable, production-ready
📦 Installation
pip install .
# or for development
pip install -e .
🚀 Usage
Choose Export Mode
--export-mode |
Compatible DB URLs | Description |
|---|---|---|
postgres-query |
postgresql://, postgres:// |
SELECT + local export |
redshift-unload |
redshift:// |
UNLOAD to S3 |
sqlite-query |
sqlite:///path.db |
For local/lightweight testing |
CLI Examples
Basic Export
sqlxport run \
--export-mode postgres-query \
--db-url postgresql://user:pass@localhost:5432/mydb \
--query "SELECT * FROM users" \
--output-file users.parquet \
--format parquet
S3 Upload
sqlxport run \
--export-mode postgres-query \
--db-url postgresql://... \
--query "..." \
--output-file users.parquet \
--s3-bucket my-bucket \
--s3-key users.parquet \
--s3-access-key AKIA... \
--s3-secret-key ... \
--s3-endpoint https://s3.amazonaws.com
Partitioned Export
sqlxport run \
--export-mode postgres-query \
--db-url postgresql://... \
--query "..." \
--output-dir output/ \
--partition-by group_column \
--format csv
Redshift UNLOAD Mode
sqlxport run \
--export-mode redshift-unload \
--db-url redshift://... \
--query "SELECT * FROM large_table" \
--s3-output-prefix s3://bucket/unload/ \
--iam-role arn:aws:iam::123456789012:role/MyUnloadRole
🐍 Python API
from sqlxport.api.export import run_export, ExportJobConfig
config = ExportJobConfig(
db_url="sqlite:///test.db",
query="SELECT * FROM users",
format="csv",
output_file="out.csv",
export_mode="sqlite-query"
)
run_export(config)
🧪 Running Tests
pytest tests/unit/
pytest tests/integration/
pytest tests/e2e/
🔧 Environment Variables
Supports .env or exported shell variables:
DB_URL=postgresql://username:password@localhost:5432/mydb
S3_BUCKET=my-bucket
S3_KEY=data/users.parquet
S3_ACCESS_KEY=...
S3_SECRET_KEY=...
S3_ENDPOINT=https://s3.amazonaws.com
IAM_ROLE=arn:aws:iam::123456789012:role/MyUnloadRole
Generate a template with:
sqlxport run --generate-env-template
🛠 Roadmap
- ✅ Modular export modes
- ✅ CSV and partitioned output
- ⏳ Add
jsonl,xlsxformats - ⏳ Plugin system for writers/loaders
- ⏳ SaaS mode / UI platform
- ⏳ Kafka/Kinesis streaming support
🔐 Security
- Don’t commit
.envfiles - Use credential vaults when possible
👨💼 Author
Vahid Saber
Built with ❤️ for data engineers and developers.
📄 License
MIT License
Metadata
Release files for sqlxport 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlxport-0.2.0.tar.gz | 31.4 kB | Without provenance | Details for sqlxport-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlxport-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for sqlxport-0.2.0-py3-none-any.whl |
Total release size: 75.9 kB
Release files / sqlxport-0.2.0.tar.gz
| Download URL | sqlxport-0.2.0.tar.gz |
|---|---|
| Size | 31.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc8e645dcd2d4def6e13f5546829718122dcb9ae0caaf92b2c7b79f768f5e97b
|
|
BLAKE2b-256 checksum How to use checksums |
9185610cee7bb41b4f4399379d36aea5d6e0b59a2a7fd672c8877b4478c00f25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / sqlxport-0.2.0-py3-none-any.whl
| Download URL | sqlxport-0.2.0-py3-none-any.whl |
|---|---|
| Size | 44.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
859e3257dc5a6d7a2641fb33e258757d0e6bcb89ccb3d0f919bc982b92db6287
|
|
BLAKE2b-256 checksum How to use checksums |
f95035bddcb2d6ee77d4a5e52fd70e8f6649e7512377224bf5483949690f6b60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for sqlxport 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.