Skip to main content

Display a quick view of sql databases (and make quick edits)

Project description

catsql
======
[![Downloads](https://img.shields.io/pypi/dm/catsql.svg)](https://pypi.python.org/pypi/catsql)

Quickly display or edit part of a database. Thin wrapper around SQLAlchemy.
Pronounced "cat-skill" for some reason.

Installation
------------

`pip install catsql`

Demo
----

![Terminal demo](https://cloud.githubusercontent.com/assets/118367/13240849/048e2834-d9b4-11e5-9510-7812f2fc1b71.gif)

Examples
--------

* `catsql example.sqlite --limit 3`
* `catsql $DATABASE_URL --table users --id 20`
* `catsql $DATABASE_URL --table users --grep paul`
* `catsql $DATABASE_URL --table users --grep paul --edit` - edit whatever
slice of the database you are viewing using your default `$EDITOR`.
* `catsql postgres://foo:bar@thing.rds.amazonaws.com:5432/database` - if
you install the appropriate SqlAlchemy drivers, you can edit postgres,
mysql, ... databases in your default `$EDITOR`.

Usage
-----

```
usage: catsql [-h] [--column COLUMN] [--count] [--csv] [--edit] [--grep GREP]
[--limit LIMIT] [--load-bookmark] [--safe-null]
[--save-bookmark SAVE_BOOKMARK] [--sql SQL] [--table TABLE]
[--terse] [--value VALUE] [--verbose]
catsql_database_url

Quickly display and edit a slice of a database.

positional arguments:
catsql_database_url Database url or filename. Examples: sqlite:///data.db,
mysql://user:pass@host/db,
postgres[ql]://user:pass@host/db, data.sqlite3

optional arguments:
-h, --help show this help message and exit
--column COLUMN Column to include (defaults to all columns). Can be a
comma separated list of multiple columns.
--count Show row counts instead of actual data.
--csv Output strictly in CSV format.
--edit Edit original table in your favorite editor. Respects
$EDITOR environment variable.
--grep GREP Search cells for occurrence of a text fragment.
Translated to SQL query, performed by database.
--limit LIMIT Maximum number of rows per table.
--load-bookmark Load a set of filters from a file.
--safe-null Encode nulls in a reversible way.
--save-bookmark SAVE_BOOKMARK
Save the current set of filters specified to a file.
--sql SQL Add a raw SQL filter for rows to include. Example:
"total < 1000", "created_at > now() - interval '1
day'". Tables that don't have the columns mentioned
are omitted.
--table TABLE Table to include (defaults to all tables). Can be a
comma separated list of multiple tables.
--terse Hide any columns with predetermined values.
--value VALUE Add a column=value filter. Example:
--value id=ID --value name=Jupiter
As a shortcut you can also do:
--id ID --name Jupiter
--verbose Show raw SQL queries as they are made.
```

License
-------

MIT

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

catsql-0.2.8.tar.gz (9.7 kB view details)

Uploaded Source

File details

Details for the file catsql-0.2.8.tar.gz.

File metadata

  • Download URL: catsql-0.2.8.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for catsql-0.2.8.tar.gz
Algorithm Hash digest
SHA256 dabb01cc78e7e8cc1aa45ffc6c89f31389ca3620a88b2b7adf084819cf07f4d5
MD5 a1d2d7e6c8636e7c191cb3b33bc22ed5
BLAKE2b-256 c310f1bfce77866304b57c1140a7e7db8b9f1cbdb60d46ec08b6af5d4afa8fb7

See more details on using hashes here.

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