Skip to main content

The Crate Data Shell

Project description

Crate.IO

Test Version Downloads https://img.shields.io/badge/docs-latest-brightgreen.svg Python Version

Overview

This is the Crate shell called crash.

Installation

Installing via pip

To install crash via pip use the following command:

$ pip install crash

To update use:

$ pip install -U crash

Standalone

There is also a single file executable that includes all dependencies and can be run as long as python (>= 2.7) is available on the system.

Download Crash bundle

The bundle can then be executed using python:

python ./crash_standalone_latest

Or:

chmod +x ./crash_standalone_latest
./crash_standalone_latest

Crash supported Python 2.6 until 0.16. Use Crash 0.16.0 if you’re running Python 2.6

Usage

If the package was installed using pip the shell can be started by running the command crash in a terminal.

For usage information and command line options invoke:

crash --help

Or consult the crash documentation 📚.

Are you a Developer?

You can build Crash on your own with the latest version hosted on GitHub. To do so, please refer to DEVELOP.rst for further information.

Help & Contact

Do you have any questions? Or suggestions? We would be very happy to help you. So, feel free to swing by our Community on Slack. Or for further information and official contact please visit https://crate.io/.

License

Copyright 2013-2014 CRATE Technology GmbH (“Crate”)

Licensed to CRATE Technology GmbH (“Crate”) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Crate licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

However, if you have executed another commercial license agreement with Crate these terms will supersede the license and you may use the software solely pursuant to the terms of the relevant commercial agreement.

Installation & Usage

If the package was installed using pip the shell can be started by invoking crash in a terminal.

pip install 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 OKCLUSTER CHECK 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 OKCLUSTER CHECK OK

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

cr> SELECT schema_name, table_name FROM information_schema.tables
... ORDER BY table_name;
+--------------------+-------------------+
| schema_name        | table_name        |
+--------------------+-------------------+
| sys                | checks            |
| sys                | cluster           |
| information_schema | columns           |
| sys                | jobs              |
| sys                | jobs_log          |
| sys                | nodes             |
| sys                | operations        |
| sys                | operations_log    |
| sys                | repositories      |
| information_schema | routines          |
| information_schema | schemata          |
| sys                | shards            |
| sys                | snapshots         |
| information_schema | table_constraints |
| information_schema | table_partitions  |
| information_schema | tables            |
+--------------------+-------------------+
SELECT 16 rows in set (... sec)

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

cr> select x from y;
SQLActionException[Table 'doc.y' unknown]
io.crate.exceptions.TableUnknownException: Table 'doc.y' unknown
    at io.crate.metadata.ReferenceInfos.getTableInfo(ReferenceInfos.java:...)
...

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.17.1.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

crash-0.17.1-py2.py3-none-any.whl (49.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for crash-0.17.1.tar.gz
Algorithm Hash digest
SHA256 366e255fd5031caa6f545dd6128725e6aeaab4f1552c842e18c840122a5e9438
MD5 66395ff6266901c3aa1d146eae669b66
BLAKE2b-256 349ff4bc3283057666b7348b3d9b8601e31b03c5565c10f8b965731614472aff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crash-0.17.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1828a24ea2d198c642526ac22ef80072ef272a00d55a84384a5ed701360261c8
MD5 76dcf2fdc9b64e272183cec2337dad46
BLAKE2b-256 049ac0b3460ee8291e3445d41a51e0c96bc9b0d26175923db83cd0fb5dc25516

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