Skip to main content

Simple SQL REPL Command Handler

Project description

squelch

Squelch is a package providing a Simple SQL REPL Command Handler. Squelch uses SQLAlchemy for database access and so can support any database engine that SQLAlchemy supports, thereby providing a common database client experience for any of those database engines. Squelch is modelled on a simplified psql, the PostgreSQL command line client. The Squelch CLI supports readline history and basic SQL statement tab completions.

Install

The package can be installed from PyPI:

$ pip install squelch

From the command line

The package comes with a functional CLI called squelch, which just calls the package main, hence the following two invocations are equivalent:

$ python3 -m squelch
$ squelch

The only required argument is a database connection URL. This can either be passed on the command line, via the --url option, or specified in a JSON configuration file given by the --conf-file option. The form of the JSON configuration file is as follows:

{
  "url": "<URL>"
}

where the <URL> follows the SQLAlchemy database connection URL syntax. An advantage of using a configuration file is that it avoids providing database login credentials in plain text on the command line.

Command line usage

usage: squelch [-h] [-c CONF_FILE] [-u URL] [-v] [-V]

Squelch is a Simple SQL REPL Command Handler.

optional arguments:
  -h, --help            show this help message and exit
  -c CONF_FILE, --conf-file CONF_FILE
                        The full path to a JSON configuration file. It
                        defaults to ./squelch.json.
  -u URL, --url URL     The database connection URL, as required by
                        sqlalchemy.create_engine().
  -v, --verbose         Turn verbose messaging on. The effects of this option
                        are incremental.
  -V, --version         show program's version number and exit

Database Connection URL

The database connection URL can either be passed on the command line, via the --url option, or specified in a JSON configuration file given by the --conf-file option.  The form of the JSON configuration file is as follows:

{
  "url": "<URL>"
}

From the SQLAlchemy documentation:

"The string form of the URL is dialect[+driver]://user:password@host/dbname[?key=value..], where dialect is a database name such as mysql, oracle, postgresql, etc., and driver the name of a DBAPI, such as psycopg2, pyodbc, cx_oracle, etc. Alternatively, the URL can be an instance of URL."

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

squelch-0.2.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

squelch-0.2.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file squelch-0.2.0.tar.gz.

File metadata

  • Download URL: squelch-0.2.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.10 Linux/5.15.0-91-generic

File hashes

Hashes for squelch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dccc34207882326580080a959b82756a323fd512ca050e548b2f759fab3218b7
MD5 068a5c4a1c8a34820f4f7c2824f81c06
BLAKE2b-256 d6f8ad5ba3f6488c48e88a75945a4ab90fd785ae817922a2555846188b39b212

See more details on using hashes here.

File details

Details for the file squelch-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: squelch-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.10 Linux/5.15.0-91-generic

File hashes

Hashes for squelch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30511465ccc7a2448b339d7bfcb0d8f52104d2c002899d9f78150d7984b24f45
MD5 53e0e781edd97f986e47303187630eec
BLAKE2b-256 7f31336711b8f60b05d822c621bd424dbdcd1419bc0f9813bae1c37f64f5182e

See more details on using hashes here.

Supported by

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