Skip to main content

CLI to view and kill running queries in postgres

Project description

Copyright (c) 2018 Frame.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Description:
# DIMA

A command-line tool to list, inspect and kill database queries.

We've been using this tool since 2017 at Frame.io and decided to open source it. There will be a blog post with more details on the Frame.io Engineering Blog soon. Previous git history has been wiped by our security team.

# Setup:

1. Clone this repo
2. Set up the credentials (see below)
3. Run: `python setup.py install`

(homebrew setup is being worked on)

# Credential Setup

Database credentials can be provided in 2 ways - in a `~/.dima_creds` file or as environment variables. DIMA will look first for the environment variables, and then to the creds file. You can set the following environment variables:

DIMA_DB_DBNAME
DIMA_DB_USER
DIMA_DB_HOST
DIMA_DB_PORT
DIMA_DB_PASSWORD

or place them in a `~/.dima_creds` file (the prefix `~/` means that it should be in your home directory). A sample file `sample_creds` is in this repo.

You can add more credentials for different databases underneath, as long as they use a different prefix. E.g.

DIMA_DB2_DBNAME
DIMA_DB2_USER
...

To inspect a non-default DB, use the `-c` option, e.g. for a prefix `DIMA_DB2_...` use:

dima -c DB2 show 123

# Usage:

dima
Shows a list of running queries

dima show [PID]
Inspects a specific running query

dima rm [-f] [Lock / filter keyword / PID]

Terminates queries either with `wait_event_type` "Lock" or according to a filter keyword or PID. Use -f to avoid the confirmation.

# Screenshots

<img src="https://github.com/Frameio/homebrew-dima/raw/master/img/dima_cmd.png" alt="dima command" width="500"/>
<img src="https://github.com/Frameio/homebrew-dima/raw/master/img/dima_show_cmd.png" alt="dima show command" width="500"/>
<img src="https://github.com/Frameio/homebrew-dima/raw/master/img/dima_rm_cmd.png" alt="dima rm command" width="500"/>


Platform: UNKNOWN
Classifier: Programming Language :: Python :: 2.7
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database

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

dima-db-1.0.0.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

dima_db-1.0.0-py2-none-any.whl (5.8 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page