Metadata-Version: 2.1
Name: mysql-tracer
Version: 1.1.1
Summary: A MySQL client to run queries, write execution reports and export results
Home-page: https://github.com/AdrienHorgnies/py-mysql-tracer
Author: Adrien Horgnies
Author-email: adrien.pierre.horgnies@gmail.com
License: MIT License
Download-URL: https://github.com/AdrienHorgnies/py-mysql-tracer/archive/1.1.1.tar.gz
Keywords: mysql,client,report,export
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Description-Content-Type: text/markdown
Requires-Dist: mysql-connector-python
Requires-Dist: pyyaml
Requires-Dist: alone
Requires-Dist: keyring

# mysql_tracer
A MySQL client to run queries, write execution reports and export results.

It is made with the purpose to support SELECT statements only.
Other statements will work but the features offered by this module will provide little help or make no sense.

## Usage

This can be used as a command line tool:
```
$ mysql_tracer -h
usage: mysql_tracer [-h] --host HOST --user USER [--database DATABASE] [-a]
                    [-s] [-d DESTINATION | --display]
                    query [query ...]

positional arguments:
  query                 Path to a file containing a single sql statement

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           MySQL server host
  --user USER           MySQL server user
  --database DATABASE   MySQL database name
  -a, --ask-password    Do not try to retrieve password from keyring, always
                        ask password
  -s, --store_password  Store password into keyring after connecting to the
                        database
  -d DESTINATION, --destination DESTINATION
                        Directory where to export results
  --display             Do not export results but display them to stdout

```

It exposes the class `Query`. The constructor needs a path to a file containing a single sql statement and instances 
expose the method `export` which creates a timestamped copy of the original file, appended with an execution report and
an export of the result in the csv format. 

## Development

You can install dependencies with `pip install -r requirements.txt`.

You can run tests with `pytest` but you need to set `PYTHONPATH`.
```
$ export PYTHONPATH=mysql_tracer
$ python3 -m pytest
```

Or you can setup a test run with your IDE without any particular configuration.


