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
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
Interactive Mode
If you run pySQLExport without arguments, it will start in interactive mode:
pySQLExport
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.json --output csv --outfile results.csv
- Run the command above.
- 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.json
-
Export results to CSV:
pySQLExport --query "YOUR_QUERY_HERE" --config_file config.json --output csv --outfile results.csv
-
Export results to JSON:
pySQLExport --query "YOUR_QUERY_HERE" --config_file config.json --output json --outfile results.json
-
Run in interactive mode:
pySQLExport
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysqlexport-0.1.3.tar.gz.
File metadata
- Download URL: pysqlexport-0.1.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
202deb00ff21843e0383419d88eb2781ff5a4abdfc2da64929a8c95b2510a63b
|
|
| MD5 |
f2db71b621c0c04ccd8257d43de898cb
|
|
| BLAKE2b-256 |
7ac054aa50c47e6f70d857ec28a761dfcb9e65f7524553f1278086c790c797d6
|
File details
Details for the file pySQLExport-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pySQLExport-0.1.3-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29dd69717d2604706b2afec096e135bbfbfa56f551306149cd4546383114446c
|
|
| MD5 |
eb671176640e1b951c94a79a94b6c068
|
|
| BLAKE2b-256 |
d1d26fdcd6f870be7a14e8b3642be22b05d078ff113c84bba62adfca28ace89e
|