Skip to main content

The Crate Data Shell

Project description

Crash

Travis CI Version Documentation Python Version Coverage

Crash is an interactive CrateDB command line interface (CLI) SQL shell with autocompletion.

Screenshot

A screenshot of Crash

Prerequisites

Recent versions of Crash require Python (>= 2.7) to run.

Use Crash 0.16.0 if you’re running Python 2.6.

Installation

As a Python Package

Crash is available as a pip package.

To install, run:

$ pip install crash

Now, run it:

$ crash

To update, run:

$ pip install -U crash

Standalone

Crash is also available as a standalone executable that includes all the necessary dependencies, and can be run as long as Python (>= 2.7) is available.

First, download the executable:

$ curl -o crash https://cdn.crate.io/downloads/releases/crash_standalone_latest

Then, make it executable:

$ chmod +x crash

Now, run it:

$ ./crash

If you would like to run crash from any directory and without using leading ./ you will need to move it to somewhere on your $PATH.

Usage

For usage information and options, run:

$ crash --help

Contributing

This project is primarily maintained by Crate.io, but we welcome community contributions!

See the developer docs and the contribution docs for more information.

Help

Looking for more help?

Installation & Usage

If the package was installed using pip the shell can be started by invoking crash in a terminal. We recommend to install it to the Python user install directory to avoid unwanted dependency conflicts.

pip install --user crash

crash by default will try to connect to localhost:4200. To connect to another host use the connect command inside the shell or use the --hosts argument when launching the shell.

crash started with the -v switch (once or more times) will log useful information when it comes to debugging, like what connection attempts are made and full tracebacks of server errors.

For more information about the available command line arguments see Command Line Arguments.

When you connect to a server that is not reachable or whose hostname cannot be resolved you will get an error:

cr> \connect 127.0.0.1:65535
+------------------------+-----------+---------+-----------+-----------...-+
| server_url             | node_name | version | connected | message       |
+------------------------+-----------+---------+-----------+-----------...-+
| http://127.0.0.1:65535 |      NULL | 0.0.0   | FALSE     | Server not... |
+------------------------+-----------+---------+-----------+-----------...-+
CONNECT ERROR
cr> \connect 300.300.300.300:4200
+-----------------------------+-----------+---------+-----------+-------------...-+
| server_url                  | node_name | version | connected | message         |
+-----------------------------+-----------+---------+-----------+-------------...-+
| http://300.300.300.300:4200 |      NULL | 0.0.0   | FALSE     | Server not a... |
+-----------------------------+-----------+---------+-----------+-------------...-+
CONNECT ERROR

Successful connects will give you some information about the servers you connect to:

cr> \connect 127.0.0.1:44209;
+------------------------+-----------+---------+-----------+---------+
| server_url             | node_name | version | connected | message |
+------------------------+-----------+---------+-----------+---------+
| http://127.0.0.1:44209 | crate     | ...     | TRUE      | OK      |
+------------------------+-----------+---------+-----------+---------+
CONNECT OK...

If you connect to more than one server, the command will succeed if at least one server is reachable:

cr> \connect 127.0.0.1:44209 300.300.300.300:4295;
+-----------------------------+-----------+---------+-----------+-----------...-+
| server_url                  | node_name | version | connected | message       |
+-----------------------------+-----------+---------+-----------+-----------...-+
| http://127.0.0.1:44209      | crate     | ...     | TRUE      | OK            |
| http://300.300.300.300:4295 | NULL      | 0.0.0   | FALSE     | Server not... |
+-----------------------------+-----------+---------+-----------+-----------...-+
CONNECT OK...

Once the shell is connected, SQL statements can be executed simply by entering them without any special arguments like this:

cr> SELECT table_name FROM information_schema.tables
... WHERE table_name = 'cluster';
+------------+
| table_name |
+------------+
| cluster    |
+------------+
SELECT 1 row in set (... sec)

When the Crate shell is started with the option -v debugging information will be printed:

cr> select x from y;
SQLActionException[TableUnknownException: Table 'doc.y' unknown]
SQLActionException: NOT_FOUND 4041 TableUnknownException: Table 'doc.y' unknown
...

Limitations

Nested Objects and Arrays

While it is possible to select or filter by nested objects it is currently not possible to insert them using Crash. In order to do that the Crate REST endpoint or a client library like crate-python has to be used.

The same also applies for arrays.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crash-0.21.0.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

crash-0.21.0-py2.py3-none-any.whl (55.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file crash-0.21.0.tar.gz.

File metadata

  • Download URL: crash-0.21.0.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crash-0.21.0.tar.gz
Algorithm Hash digest
SHA256 9113491db57ef8b8ed00136d814a4f419b008b60b680b0d2d8e3081f25b4567d
MD5 e487e3130caaf3b26d171c4bf2cd5275
BLAKE2b-256 84682d858a92c6f9e15d949f3d6a0998adc31b4d27ebe546cafd88a02216d52f

See more details on using hashes here.

File details

Details for the file crash-0.21.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for crash-0.21.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ee758b249de88660554ed64eb6047316af9cd447f64e6387334e4f7323d51e14
MD5 0ce8f270046d55c82f6bf4d44a986a0f
BLAKE2b-256 b948be0fa00f850cca7b41a02f215f6d2c6df32385b143ddc243f63910ee4398

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