Skip to main content

CLI for the Materialize streaming database. With auto-completion and syntax highlighting.

Project description

A REPL for the Materialize Streaming Database Engine

See https://materialize.io for an introduction to Materialize.

Quick Start

The easiest way to get started with mzcli with a remote materialized is to use docker:

docker run -it materialize/mzcli --help

This is a work-in-progress materialize client that does auto-completion and syntax highlighting. It is a soft fork of mzcli, and will hopefully one day be even less of a fork from mzcli, but due to materialize’s extra functionality this will be a long-lived tool for interacting with materialized.

screenshots/mzcli.gif screenshots/image01.png

Usage

$ mzcli [database_name]

or

$ mzcli postgresql://[user[:password]@][netloc][:port][/dbname][?extra=value[&other=other-value]]

Examples:

$ mzcli local_database

$ mzcli postgres://amjith:pa$$w0rd@example.com:5432/app_db?sslmode=verify-ca&sslrootcert=/myrootcert

For more details:

$ mzcli --help

Usage: mzcli [OPTIONS] [DBNAME] [USERNAME]

Options:
  -h, --host TEXT         Host address of the postgres database.
  -p, --port INTEGER      Port number at which the postgres instance is
                          listening.
  -U, --username TEXT     Username to connect to the postgres database.
  -u, --user TEXT         Username to connect to the postgres database.
  -W, --password          Force password prompt.
  -w, --no-password       Never prompt for password.
  --single-connection     Do not use a separate connection for completions.
  -v, --version           Version of mzcli.
  -d, --dbname TEXT       database name to connect to.
  --mzclirc PATH          Location of mzclirc file.
  -D, --dsn TEXT          Use DSN configured into the [alias_dsn] section of
                          mzclirc file.
  --list-dsn              list of DSN configured into the [alias_dsn] section
                          of mzclirc file.
  --row-limit INTEGER     Set threshold for row limit prompt. Use 0 to disable
                          prompt.
  --less-chatty           Skip intro on startup and goodbye on exit.
  --prompt TEXT           Prompt format (Default: "\u@\h:\d> ").
  --prompt-dsn TEXT       Prompt format for connections using DSN aliases
                          (Default: "\u@\h:\d> ").
  -l, --list              list available databases, then exit.
  --auto-vertical-output  Automatically switch to vertical output mode if the
                          result is wider than the terminal width.
  --warn / --no-warn      Warn before running a destructive query.
  --help                  Show this message and exit.

mzcli also supports many of the same environment variables as psql for login options (e.g. PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE).

Features

The mzcli is written using prompt_toolkit.

  • Auto-completes as you type for SQL keywords as well as tables and columns in the database.

  • Syntax highlighting using Pygments.

  • Smart-completion (enabled by default) will suggest context-sensitive completion.

    • SELECT * FROM <tab> will only show table names.

    • SELECT * FROM users WHERE <tab> will only show column names.

  • Primitive support for psql back-slash commands.

  • Pretty prints tabular data.

Config

A config file is automatically created at ~/.config/mzcli/config at first launch. See the file itself for a description of all available options.

Contributions:

While we are not mzcli, the following documentation expresses our sentiments and still correctly represents the development workflow.

If you’re interested in contributing to this project, first of all I would like to extend my heartfelt gratitude. I’ve written a small doc to describe how to get this running in a development setup.

https://github.com/dbcli/mzcli/blob/master/DEVELOP.rst

Please feel free to file an issue if you need help, or jump in our community slack.

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

mzcli-3.0.0.tar.gz (122.5 kB view details)

Uploaded Source

Built Distribution

mzcli-3.0.0-py3-none-any.whl (71.9 kB view details)

Uploaded Python 3

File details

Details for the file mzcli-3.0.0.tar.gz.

File metadata

  • Download URL: mzcli-3.0.0.tar.gz
  • Upload date:
  • Size: 122.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

File hashes

Hashes for mzcli-3.0.0.tar.gz
Algorithm Hash digest
SHA256 2a890714a40c8b5f72ad47003bdd48f0a091a20be554909d273aeb4f06c2afd8
MD5 944e76fb16a4a1d3a7e92d36f6556b62
BLAKE2b-256 ecd9c9c2dd33180bc748d5d366ec761692a2e4d27c2de923415f2849a8d4dcf0

See more details on using hashes here.

File details

Details for the file mzcli-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: mzcli-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 71.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

File hashes

Hashes for mzcli-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33cbc3d71e7de4efa7733bddf80a6a122e570cf455be3e8325a32d942a65ee1e
MD5 5f84200d8cde1ce042874d143f1ee298
BLAKE2b-256 5aa835acb427e1e3e0c5e6b28bd6bea7b5e63e32f5d3b465371966cd44845f19

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