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 details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 2

File details

Details for the file dima-db-1.0.0.tar.gz.

File metadata

  • Download URL: dima-db-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for dima-db-1.0.0.tar.gz
Algorithm Hash digest
SHA256 49bbd375591cc498029e5353911cdd891ae09d876cb836a4f5dbb333146d9b2c
MD5 296108d5d3e3f3c1799d321c4a446903
BLAKE2b-256 b3dba6bcbb8b5d80e67e687a72b1ad649d89cd623d3e7b8a791466db0a8f4071

See more details on using hashes here.

File details

Details for the file dima_db-1.0.0-py2-none-any.whl.

File metadata

  • Download URL: dima_db-1.0.0-py2-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for dima_db-1.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 38b436ab22bc1c92c037182ab2e8bac38236c367da79bfc51a9bee96d321acff
MD5 a957b9b0c9bac59f194e0befd9a11d0c
BLAKE2b-256 5905d0ed6340aac86b192fd4c52c8902ca7443b2e620ed1f94b4240e3796a4f7

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