Skip to main content

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.

Release files for mzcli 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mzcli 3.0.0
File Size Uploaded
mzcli-3.0.0.tar.gz 122.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mzcli 3.0.0
File Interpreter ABI Platform
mzcli-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 194.4 kB

Release files / mzcli-3.0.0.tar.gz

Download URL mzcli-3.0.0.tar.gz
Size 122.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2a890714a40c8b5f72ad47003bdd48f0a091a20be554909d273aeb4f06c2afd8
BLAKE2b-256 checksum
How to use checksums
ecd9c9c2dd33180bc748d5d366ec761692a2e4d27c2de923415f2849a8d4dcf0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / mzcli-3.0.0-py3-none-any.whl

Download URL mzcli-3.0.0-py3-none-any.whl
Size 71.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33cbc3d71e7de4efa7733bddf80a6a122e570cf455be3e8325a32d942a65ee1e
BLAKE2b-256 checksum
How to use checksums
5aa835acb427e1e3e0c5e6b28bd6bea7b5e63e32f5d3b465371966cd44845f19
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page