Skip to main content

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

Project description

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.

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

mysql_tracer-1.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

mysql_tracer-1.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file mysql_tracer-1.1.1.tar.gz.

File metadata

  • Download URL: mysql_tracer-1.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for mysql_tracer-1.1.1.tar.gz
Algorithm Hash digest
SHA256 7d42da7e0100ad8d3cd6f44641a81c6106fe265edde949f2d87a29702de7e72d
MD5 848a70e61427c9e6e5e1eda21545b482
BLAKE2b-256 4ee380d948188a974c449f475aa3ec580a0c61120b35e3ab9f55cc081a98ae53

See more details on using hashes here.

File details

Details for the file mysql_tracer-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: mysql_tracer-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for mysql_tracer-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 af9c447cfaab86309e910e657a1d5d178d4412c17979975fa6de454dfd28c4de
MD5 4a0ebe2ce8b674d96f1a90ff6c432755
BLAKE2b-256 f9145e626e13eec00e37cef731f2da2c7949c4c8a96f86ac0a63d1994429dfcb

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