Skip to main content

A command line tool to interact with MySQL databases and export to other formats.

Project description

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.

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

pySQLExport-0.1.4.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

pySQLExport-0.1.4-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file pySQLExport-0.1.4.tar.gz.

File metadata

  • Download URL: pySQLExport-0.1.4.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pySQLExport-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a60a34b20ec6375149f61bdf8f5eb284d8297bfd48415fb3ea42009780243b2b
MD5 f9de479c28eeafa2d932fdf1b9e360ef
BLAKE2b-256 af901725d148f8d367fc4bcdebf6c478af3a11241555871ba9214a647abb281f

See more details on using hashes here.

File details

Details for the file pySQLExport-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pySQLExport-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pySQLExport-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5adc675606099963c7fd4d1a9e74188e8d08a68e18605979b7a43cf5d36cbc44
MD5 4dedc05a3b4c68927d889b3e51e5ece7
BLAKE2b-256 b6ce990c2ee4522131c34a0e13174d6d170ce383dbf32390f0f26f09f27afdb8

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