Skip to main content

pySQLExport

A command line tool to interact with multiple databases and export to various formats.

Installation

You can install the package using pip:

pip install pySQLExport

Configuration

Before using pySQLExport, ensure you have a configuration file or environment variables set up for your database connection.

Usage

You can run pySQLExport in either interactive mode, which allows you to run multiple queries and export to multiple formats. You can also pass command line arguments for single-run exports or queries.

Interactive Mode

If you run pySQLExport without arguments, it will start in interactive mode:

pySQLExport

Command Line Interface

Running a Query

To run a query and display the results in the terminal:

pySQLExport --query "SELECT * FROM employees" --config-file config.yaml

Exporting Results

To export query results to a CSV file:

pySQLExport --query "SELECT * FROM employees" --config-file config.yaml --output=csv --outfile results.csv

To export query results to a JSON file:

pySQLExport --query "SELECT * FROM employees" --config-file config.yaml --output=json --outfile results.json

To export query results to a XML file:

pySQLExport --query "SELECT * FROM employees" --config-file config.yaml --output=json --outfile results.xml

To export query results to a html file:

pySQLExport --query "SELECT * FROM employees" --config-file config.yaml --output=json --outfile results.html

In interactive mode, you can enter the database information, run queries, and choose how to export the results.

Example

Here’s a complete example of how to use pySQLExport:

pySQLExport --query "SELECT * FROM employees" --config-file config.yaml --output csv --outfile results.csv
  1. Run the command above.
  2. The results will be exported to a file named results.csv.

Summary of Commands

  • Run a query and display results:

    pySQLExport --query "YOUR_QUERY_HERE" --config-file config.yaml
    
  • Export results to CSV:

    pySQLExport --query "YOUR_QUERY_HERE" --config-file config.yaml --output csv --outfile results.csv
    
  • Export results to JSON:

    pySQLExport --query "YOUR_QUERY_HERE" --config_file config.yaml --output json --outfile results.json
    
  • Export results to html:

pySQLExport --query "SELECT * FROM employees" --config-file config.yaml --output=json --outfile results.xml
  • Export results to xml:
pySQLExport --query "SELECT * FROM employees" --config-file config.yaml --output=json --outfile results.html

Contributing

Contributions are welcome! Please read the contributing guidelines first.

License

This project is licensed under the GPLv3 License. See the LICENSE file for details.

Release files for pySQLExport 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pySQLExport 0.1.4
File Size Uploaded
pySQLExport-0.1.4.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pySQLExport 0.1.4
File Interpreter ABI Platform
pySQLExport-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 37.9 kB

Release files / pySQLExport-0.1.4.tar.gz

Download URL pySQLExport-0.1.4.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a60a34b20ec6375149f61bdf8f5eb284d8297bfd48415fb3ea42009780243b2b
BLAKE2b-256 checksum
How to use checksums
af901725d148f8d367fc4bcdebf6c478af3a11241555871ba9214a647abb281f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / pySQLExport-0.1.4-py3-none-any.whl

Download URL pySQLExport-0.1.4-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5adc675606099963c7fd4d1a9e74188e8d08a68e18605979b7a43cf5d36cbc44
BLAKE2b-256 checksum
How to use checksums
b6ce990c2ee4522131c34a0e13174d6d170ce383dbf32390f0f26f09f27afdb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page