| |
| |
| <!DOCTYPE html> |
| <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> |
| <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> |
| <head> |
| <meta charset="utf-8"> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <title>cqlsh: the CQL shell — Apache Cassandra Documentation v3.11.11</title> |
| |
| |
| |
| |
| |
| |
| |
| |
| <script type="text/javascript" src="../_static/js/modernizr.min.js"></script> |
| |
| |
| <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> |
| <script type="text/javascript" src="../_static/jquery.js"></script> |
| <script type="text/javascript" src="../_static/underscore.js"></script> |
| <script type="text/javascript" src="../_static/doctools.js"></script> |
| <script type="text/javascript" src="../_static/language_data.js"></script> |
| |
| <script type="text/javascript" src="../_static/js/theme.js"></script> |
| |
| |
| |
| |
| <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/extra.css" type="text/css" /> |
| <link rel="index" title="Index" href="../genindex.html" /> |
| <link rel="search" title="Search" href="../search.html" /> |
| <link rel="next" title="Nodetool" href="nodetool.html" /> |
| <link rel="prev" title="Cassandra Tools" href="index.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| |
| |
| <div class="wy-grid-for-nav"> |
| |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| |
| |
| <a href="../index.html" class="icon icon-home"> Apache Cassandra |
| |
| |
| |
| </a> |
| |
| |
| |
| |
| <div class="version"> |
| 3.11.11 |
| </div> |
| |
| |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| |
| </div> |
| |
| <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
| |
| |
| |
| |
| |
| |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../getting_started/index.html">Getting Started</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../architecture/index.html">Architecture</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../data_modeling/index.html">Data Modeling</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../cql/index.html">The Cassandra Query Language (CQL)</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../configuration/index.html">Configuring Cassandra</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="index.html">Cassandra Tools</a><ul class="current"> |
| <li class="toctree-l2 current"><a class="current reference internal" href="#">cqlsh: the CQL shell</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#compatibility">Compatibility</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#optional-dependencies">Optional Dependencies</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#pytz">pytz</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#cython">cython</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="#cqlshrc">cqlshrc</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#command-line-options">Command Line Options</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#special-commands">Special Commands</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#consistency"><code class="docutils literal notranslate"><span class="pre">CONSISTENCY</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#serial-consistency"><code class="docutils literal notranslate"><span class="pre">SERIAL</span> <span class="pre">CONSISTENCY</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#show-version"><code class="docutils literal notranslate"><span class="pre">SHOW</span> <span class="pre">VERSION</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#show-host"><code class="docutils literal notranslate"><span class="pre">SHOW</span> <span class="pre">HOST</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#show-session"><code class="docutils literal notranslate"><span class="pre">SHOW</span> <span class="pre">SESSION</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#source"><code class="docutils literal notranslate"><span class="pre">SOURCE</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#capture"><code class="docutils literal notranslate"><span class="pre">CAPTURE</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#help"><code class="docutils literal notranslate"><span class="pre">HELP</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#tracing"><code class="docutils literal notranslate"><span class="pre">TRACING</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#paging"><code class="docutils literal notranslate"><span class="pre">PAGING</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#expand"><code class="docutils literal notranslate"><span class="pre">EXPAND</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#login"><code class="docutils literal notranslate"><span class="pre">LOGIN</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#exit"><code class="docutils literal notranslate"><span class="pre">EXIT</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#clear"><code class="docutils literal notranslate"><span class="pre">CLEAR</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#describe"><code class="docutils literal notranslate"><span class="pre">DESCRIBE</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#copy-to"><code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#copy-from"><code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">FROM</span></code></a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="nodetool.html">Nodetool</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> |
| </ul> |
| |
| |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
| |
| |
| <nav class="wy-nav-top" aria-label="top navigation"> |
| |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../index.html">Apache Cassandra</a> |
| |
| </nav> |
| |
| |
| <div class="wy-nav-content"> |
| |
| <div class="rst-content"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <div role="navigation" aria-label="breadcrumbs navigation"> |
| |
| <ul class="wy-breadcrumbs"> |
| |
| <li><a href="../index.html">Docs</a> »</li> |
| |
| <li><a href="index.html">Cassandra Tools</a> »</li> |
| |
| <li>cqlsh: the CQL shell</li> |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../_sources/tools/cqlsh.rst.txt" rel="nofollow"> View page source</a> |
| |
| |
| </li> |
| |
| </ul> |
| |
| |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <div class="section" id="cqlsh-the-cql-shell"> |
| <span id="cqlsh"></span><h1>cqlsh: the CQL shell<a class="headerlink" href="#cqlsh-the-cql-shell" title="Permalink to this headline">¶</a></h1> |
| <p>cqlsh is a command line shell for interacting with Cassandra through CQL (the Cassandra Query Language). It is shipped |
| with every Cassandra package, and can be found in the bin/ directory alongside the cassandra executable. cqlsh utilizes |
| the Python native protocol driver, and connects to the single node specified on the command line.</p> |
| <div class="section" id="compatibility"> |
| <h2>Compatibility<a class="headerlink" href="#compatibility" title="Permalink to this headline">¶</a></h2> |
| <p>cqlsh is compatible with Python 2.7.</p> |
| <p>In general, a given version of cqlsh is only guaranteed to work with the version of Cassandra that it was released with. |
| In some cases, cqlsh make work with older or newer versions of Cassandra, but this is not officially supported.</p> |
| </div> |
| <div class="section" id="optional-dependencies"> |
| <h2>Optional Dependencies<a class="headerlink" href="#optional-dependencies" title="Permalink to this headline">¶</a></h2> |
| <p>cqlsh ships with all essential dependencies. However, there are some optional dependencies that can be installed to |
| improve the capabilities of cqlsh.</p> |
| <div class="section" id="pytz"> |
| <h3>pytz<a class="headerlink" href="#pytz" title="Permalink to this headline">¶</a></h3> |
| <p>By default, cqlsh displays all timestamps with a UTC timezone. To support display of timestamps with another timezone, |
| the <a class="reference external" href="http://pytz.sourceforge.net/">pytz</a> library must be installed. See the <code class="docutils literal notranslate"><span class="pre">timezone</span></code> option in <a class="reference internal" href="#cqlshrc">cqlshrc</a> for |
| specifying a timezone to use.</p> |
| </div> |
| <div class="section" id="cython"> |
| <h3>cython<a class="headerlink" href="#cython" title="Permalink to this headline">¶</a></h3> |
| <p>The performance of cqlsh’s <code class="docutils literal notranslate"><span class="pre">COPY</span></code> operations can be improved by installing <a class="reference external" href="http://cython.org/">cython</a>. This will |
| compile the python modules that are central to the performance of <code class="docutils literal notranslate"><span class="pre">COPY</span></code>.</p> |
| </div> |
| </div> |
| <div class="section" id="cqlshrc"> |
| <h2>cqlshrc<a class="headerlink" href="#cqlshrc" title="Permalink to this headline">¶</a></h2> |
| <p>The <code class="docutils literal notranslate"><span class="pre">cqlshrc</span></code> file holds configuration options for cqlsh. By default this is in the user’s home directory at |
| <code class="docutils literal notranslate"><span class="pre">~/.cassandra/cqlsh</span></code>, but a custom location can be specified with the <code class="docutils literal notranslate"><span class="pre">--cqlshrc</span></code> option.</p> |
| <p>Example config values and documentation can be found in the <code class="docutils literal notranslate"><span class="pre">conf/cqlshrc.sample</span></code> file of a tarball installation. You |
| can also view the latest version of <a class="reference external" href="https://github.com/apache/cassandra/blob/trunk/conf/cqlshrc.sample">cqlshrc online</a>.</p> |
| </div> |
| <div class="section" id="command-line-options"> |
| <h2>Command Line Options<a class="headerlink" href="#command-line-options" title="Permalink to this headline">¶</a></h2> |
| <p>Usage:</p> |
| <p><code class="docutils literal notranslate"><span class="pre">cqlsh</span> <span class="pre">[options]</span> <span class="pre">[host</span> <span class="pre">[port]]</span></code></p> |
| <p>Options:</p> |
| <dl class="simple"> |
| <dt><code class="docutils literal notranslate"><span class="pre">-C</span></code> <code class="docutils literal notranslate"><span class="pre">--color</span></code></dt><dd><p>Force color output</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--no-color</span></code></dt><dd><p>Disable color output</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--browser</span></code></dt><dd><p>Specify the browser to use for displaying cqlsh help. This can be one of the <a class="reference external" href="https://docs.python.org/2/library/webbrowser.html">supported browser names</a> (e.g. <code class="docutils literal notranslate"><span class="pre">firefox</span></code>) or a browser path followed by <code class="docutils literal notranslate"><span class="pre">%s</span></code> (e.g. |
| <code class="docutils literal notranslate"><span class="pre">/usr/bin/google-chrome-stable</span> <span class="pre">%s</span></code>).</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--ssl</span></code></dt><dd><p>Use SSL when connecting to Cassandra</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">-u</span></code> <code class="docutils literal notranslate"><span class="pre">--user</span></code></dt><dd><p>Username to authenticate against Cassandra with</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">-p</span></code> <code class="docutils literal notranslate"><span class="pre">--password</span></code></dt><dd><p>Password to authenticate against Cassandra with, should |
| be used in conjunction with <code class="docutils literal notranslate"><span class="pre">--user</span></code></p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">-k</span></code> <code class="docutils literal notranslate"><span class="pre">--keyspace</span></code></dt><dd><p>Keyspace to authenticate to, should be used in conjunction |
| with <code class="docutils literal notranslate"><span class="pre">--user</span></code></p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">-f</span></code> <code class="docutils literal notranslate"><span class="pre">--file</span></code></dt><dd><p>Execute commands from the given file, then exit</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--debug</span></code></dt><dd><p>Print additional debugging information</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--encoding</span></code></dt><dd><p>Specify a non-default encoding for output (defaults to UTF-8)</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--cqlshrc</span></code></dt><dd><p>Specify a non-default location for the <code class="docutils literal notranslate"><span class="pre">cqlshrc</span></code> file</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">-e</span></code> <code class="docutils literal notranslate"><span class="pre">--execute</span></code></dt><dd><p>Execute the given statement, then exit</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--connect-timeout</span></code></dt><dd><p>Specify the connection timeout in seconds (defaults to 2s)</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">--request-timeout</span></code></dt><dd><p>Specify the request timeout in seconds (defaults to 10s)</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">-t</span></code> <code class="docutils literal notranslate"><span class="pre">--tty</span></code></dt><dd><p>Force tty mode (command prompt)</p> |
| </dd> |
| </dl> |
| </div> |
| <div class="section" id="special-commands"> |
| <h2>Special Commands<a class="headerlink" href="#special-commands" title="Permalink to this headline">¶</a></h2> |
| <p>In addition to supporting regular CQL statements, cqlsh also supports a number of special commands that are not part of |
| CQL. These are detailed below.</p> |
| <div class="section" id="consistency"> |
| <h3><code class="docutils literal notranslate"><span class="pre">CONSISTENCY</span></code><a class="headerlink" href="#consistency" title="Permalink to this headline">¶</a></h3> |
| <p><cite>Usage</cite>: <code class="docutils literal notranslate"><span class="pre">CONSISTENCY</span> <span class="pre"><consistency</span> <span class="pre">level></span></code></p> |
| <p>Sets the consistency level for operations to follow. Valid arguments include:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ANY</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ONE</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">TWO</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">THREE</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">QUORUM</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ALL</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">LOCAL_QUORUM</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">LOCAL_ONE</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SERIAL</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">LOCAL_SERIAL</span></code></p></li> |
| </ul> |
| </div> |
| <div class="section" id="serial-consistency"> |
| <h3><code class="docutils literal notranslate"><span class="pre">SERIAL</span> <span class="pre">CONSISTENCY</span></code><a class="headerlink" href="#serial-consistency" title="Permalink to this headline">¶</a></h3> |
| <p><cite>Usage</cite>: <code class="docutils literal notranslate"><span class="pre">SERIAL</span> <span class="pre">CONSISTENCY</span> <span class="pre"><consistency</span> <span class="pre">level></span></code></p> |
| <p>Sets the serial consistency level for operations to follow. Valid arguments include:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SERIAL</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">LOCAL_SERIAL</span></code></p></li> |
| </ul> |
| <p>The serial consistency level is only used by conditional updates (<code class="docutils literal notranslate"><span class="pre">INSERT</span></code>, <code class="docutils literal notranslate"><span class="pre">UPDATE</span></code> and <code class="docutils literal notranslate"><span class="pre">DELETE</span></code> with an <code class="docutils literal notranslate"><span class="pre">IF</span></code> |
| condition). For those, the serial consistency level defines the consistency level of the serial phase (or “paxos” phase) |
| while the normal consistency level defines the consistency for the “learn” phase, i.e. what type of reads will be |
| guaranteed to see the update right away. For example, if a conditional write has a consistency level of <code class="docutils literal notranslate"><span class="pre">QUORUM</span></code> (and |
| is successful), then a <code class="docutils literal notranslate"><span class="pre">QUORUM</span></code> read is guaranteed to see that write. But if the regular consistency level of that |
| write is <code class="docutils literal notranslate"><span class="pre">ANY</span></code>, then only a read with a consistency level of <code class="docutils literal notranslate"><span class="pre">SERIAL</span></code> is guaranteed to see it (even a read with |
| consistency <code class="docutils literal notranslate"><span class="pre">ALL</span></code> is not guaranteed to be enough).</p> |
| </div> |
| <div class="section" id="show-version"> |
| <h3><code class="docutils literal notranslate"><span class="pre">SHOW</span> <span class="pre">VERSION</span></code><a class="headerlink" href="#show-version" title="Permalink to this headline">¶</a></h3> |
| <p>Prints the cqlsh, Cassandra, CQL, and native protocol versions in use. Example:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cqlsh> SHOW VERSION |
| [cqlsh 5.0.1 | Cassandra 3.8 | CQL spec 3.4.2 | Native protocol v4] |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="show-host"> |
| <h3><code class="docutils literal notranslate"><span class="pre">SHOW</span> <span class="pre">HOST</span></code><a class="headerlink" href="#show-host" title="Permalink to this headline">¶</a></h3> |
| <p>Prints the IP address and port of the Cassandra node that cqlsh is connected to in addition to the cluster name. |
| Example:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cqlsh> SHOW HOST |
| Connected to Prod_Cluster at 192.0.0.1:9042. |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="show-session"> |
| <h3><code class="docutils literal notranslate"><span class="pre">SHOW</span> <span class="pre">SESSION</span></code><a class="headerlink" href="#show-session" title="Permalink to this headline">¶</a></h3> |
| <p>Pretty prints a specific tracing session.</p> |
| <p><cite>Usage</cite>: <code class="docutils literal notranslate"><span class="pre">SHOW</span> <span class="pre">SESSION</span> <span class="pre"><session</span> <span class="pre">id></span></code></p> |
| <p>Example usage:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cqlsh> SHOW SESSION 95ac6470-327e-11e6-beca-dfb660d92ad8 |
| |
| Tracing session: 95ac6470-327e-11e6-beca-dfb660d92ad8 |
| |
| activity | timestamp | source | source_elapsed | client |
| -----------------------------------------------------------+----------------------------+-----------+----------------+----------- |
| Execute CQL3 query | 2016-06-14 17:23:13.979000 | 127.0.0.1 | 0 | 127.0.0.1 |
| Parsing SELECT * FROM system.local; [SharedPool-Worker-1] | 2016-06-14 17:23:13.982000 | 127.0.0.1 | 3843 | 127.0.0.1 |
| ... |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="source"> |
| <h3><code class="docutils literal notranslate"><span class="pre">SOURCE</span></code><a class="headerlink" href="#source" title="Permalink to this headline">¶</a></h3> |
| <p>Reads the contents of a file and executes each line as a CQL statement or special cqlsh command.</p> |
| <p><cite>Usage</cite>: <code class="docutils literal notranslate"><span class="pre">SOURCE</span> <span class="pre"><string</span> <span class="pre">filename></span></code></p> |
| <p>Example usage:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cqlsh> SOURCE '/home/thobbs/commands.cql' |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="capture"> |
| <h3><code class="docutils literal notranslate"><span class="pre">CAPTURE</span></code><a class="headerlink" href="#capture" title="Permalink to this headline">¶</a></h3> |
| <p>Begins capturing command output and appending it to a specified file. Output will not be shown at the console while it |
| is captured.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CAPTURE '<file>'; |
| CAPTURE OFF; |
| CAPTURE; |
| </pre></div> |
| </div> |
| <p>That is, the path to the file to be appended to must be given inside a string literal. The path is interpreted relative |
| to the current working directory. The tilde shorthand notation (<code class="docutils literal notranslate"><span class="pre">'~/mydir'</span></code>) is supported for referring to <code class="docutils literal notranslate"><span class="pre">$HOME</span></code>.</p> |
| <p>Only query result output is captured. Errors and output from cqlsh-only commands will still be shown in the cqlsh |
| session.</p> |
| <p>To stop capturing output and show it in the cqlsh session again, use <code class="docutils literal notranslate"><span class="pre">CAPTURE</span> <span class="pre">OFF</span></code>.</p> |
| <p>To inspect the current capture configuration, use <code class="docutils literal notranslate"><span class="pre">CAPTURE</span></code> with no arguments.</p> |
| </div> |
| <div class="section" id="help"> |
| <h3><code class="docutils literal notranslate"><span class="pre">HELP</span></code><a class="headerlink" href="#help" title="Permalink to this headline">¶</a></h3> |
| <p>Gives information about cqlsh commands. To see available topics, enter <code class="docutils literal notranslate"><span class="pre">HELP</span></code> without any arguments. To see help on a |
| topic, use <code class="docutils literal notranslate"><span class="pre">HELP</span> <span class="pre"><topic></span></code>. Also see the <code class="docutils literal notranslate"><span class="pre">--browser</span></code> argument for controlling what browser is used to display help.</p> |
| </div> |
| <div class="section" id="tracing"> |
| <h3><code class="docutils literal notranslate"><span class="pre">TRACING</span></code><a class="headerlink" href="#tracing" title="Permalink to this headline">¶</a></h3> |
| <p>Enables or disables tracing for queries. When tracing is enabled, once a query completes, a trace of the events during |
| the query will be printed.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>TRACING ON |
| TRACING OFF |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="paging"> |
| <h3><code class="docutils literal notranslate"><span class="pre">PAGING</span></code><a class="headerlink" href="#paging" title="Permalink to this headline">¶</a></h3> |
| <p>Enables paging, disables paging, or sets the page size for read queries. When paging is enabled, only one page of data |
| will be fetched at a time and a prompt will appear to fetch the next page. Generally, it’s a good idea to leave paging |
| enabled in an interactive session to avoid fetching and printing large amounts of data at once.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>PAGING ON |
| PAGING OFF |
| PAGING <page size in rows> |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="expand"> |
| <h3><code class="docutils literal notranslate"><span class="pre">EXPAND</span></code><a class="headerlink" href="#expand" title="Permalink to this headline">¶</a></h3> |
| <p>Enables or disables vertical printing of rows. Enabling <code class="docutils literal notranslate"><span class="pre">EXPAND</span></code> is useful when many columns are fetched, or the |
| contents of a single column are large.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>EXPAND ON |
| EXPAND OFF |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="login"> |
| <h3><code class="docutils literal notranslate"><span class="pre">LOGIN</span></code><a class="headerlink" href="#login" title="Permalink to this headline">¶</a></h3> |
| <p>Authenticate as a specified Cassandra user for the current session.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>LOGIN <username> [<password>] |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="exit"> |
| <h3><code class="docutils literal notranslate"><span class="pre">EXIT</span></code><a class="headerlink" href="#exit" title="Permalink to this headline">¶</a></h3> |
| <p>Ends the current session and terminates the cqlsh process.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>EXIT |
| QUIT |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="clear"> |
| <h3><code class="docutils literal notranslate"><span class="pre">CLEAR</span></code><a class="headerlink" href="#clear" title="Permalink to this headline">¶</a></h3> |
| <p>Clears the console.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CLEAR |
| CLS |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="describe"> |
| <h3><code class="docutils literal notranslate"><span class="pre">DESCRIBE</span></code><a class="headerlink" href="#describe" title="Permalink to this headline">¶</a></h3> |
| <p>Prints a description (typically a series of DDL statements) of a schema element or the cluster. This is useful for |
| dumping all or portions of the schema.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>DESCRIBE CLUSTER |
| DESCRIBE SCHEMA |
| DESCRIBE KEYSPACES |
| DESCRIBE KEYSPACE <keyspace name> |
| DESCRIBE TABLES |
| DESCRIBE TABLE <table name> |
| DESCRIBE INDEX <index name> |
| DESCRIBE MATERIALIZED VIEW <view name> |
| DESCRIBE TYPES |
| DESCRIBE TYPE <type name> |
| DESCRIBE FUNCTIONS |
| DESCRIBE FUNCTION <function name> |
| DESCRIBE AGGREGATES |
| DESCRIBE AGGREGATE <aggregate function name> |
| </pre></div> |
| </div> |
| <p>In any of the commands, <code class="docutils literal notranslate"><span class="pre">DESC</span></code> may be used in place of <code class="docutils literal notranslate"><span class="pre">DESCRIBE</span></code>.</p> |
| <p>The <code class="docutils literal notranslate"><span class="pre">DESCRIBE</span> <span class="pre">CLUSTER</span></code> command prints the cluster name and partitioner:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cqlsh> DESCRIBE CLUSTER |
| |
| Cluster: Test Cluster |
| Partitioner: Murmur3Partitioner |
| </pre></div> |
| </div> |
| <p>The <code class="docutils literal notranslate"><span class="pre">DESCRIBE</span> <span class="pre">SCHEMA</span></code> command prints the DDL statements needed to recreate the entire schema. This is especially |
| useful for dumping the schema in order to clone a cluster or restore from a backup.</p> |
| </div> |
| <div class="section" id="copy-to"> |
| <h3><code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code><a class="headerlink" href="#copy-to" title="Permalink to this headline">¶</a></h3> |
| <p>Copies data from a table to a CSV file.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>COPY <table name> [(<column>, ...)] TO <file name> WITH <copy option> [AND <copy option> ...] |
| </pre></div> |
| </div> |
| <p>If no columns are specified, all columns from the table will be copied to the CSV file. A subset of columns to copy may |
| be specified by adding a comma-separated list of column names surrounded by parenthesis after the table name.</p> |
| <p>The <code class="docutils literal notranslate"><span class="pre"><file</span> <span class="pre">name></span></code> should be a string literal (with single quotes) representing a path to the destination file. This |
| can also the special value <code class="docutils literal notranslate"><span class="pre">STDOUT</span></code> (without single quotes) to print the CSV to stdout.</p> |
| <p>See <a class="reference internal" href="#shared-copy-options"><span class="std std-ref">Shared COPY Options</span></a> for options that apply to both <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code> and <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">FROM</span></code>.</p> |
| <div class="section" id="options-for-copy-to"> |
| <h4>Options for <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code><a class="headerlink" href="#options-for-copy-to" title="Permalink to this headline">¶</a></h4> |
| <dl class="simple"> |
| <dt><code class="docutils literal notranslate"><span class="pre">MAXREQUESTS</span></code></dt><dd><p>The maximum number token ranges to fetch simultaneously. Defaults to 6.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">PAGESIZE</span></code></dt><dd><p>The number of rows to fetch in a single page. Defaults to 1000.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">PAGETIMEOUT</span></code></dt><dd><p>By default the page timeout is 10 seconds per 1000 entries |
| in the page size or 10 seconds if pagesize is smaller.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">BEGINTOKEN</span></code>, <code class="docutils literal notranslate"><span class="pre">ENDTOKEN</span></code></dt><dd><p>Token range to export. Defaults to exporting the full ring.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">MAXOUTPUTSIZE</span></code></dt><dd><p>The maximum size of the output file measured in number of lines; |
| beyond this maximum the output file will be split into segments. |
| -1 means unlimited, and is the default.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">ENCODING</span></code></dt><dd><p>The encoding used for characters. Defaults to <code class="docutils literal notranslate"><span class="pre">utf8</span></code>.</p> |
| </dd> |
| </dl> |
| </div> |
| </div> |
| <div class="section" id="copy-from"> |
| <h3><code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">FROM</span></code><a class="headerlink" href="#copy-from" title="Permalink to this headline">¶</a></h3> |
| <p>Copies data from a CSV file to table.</p> |
| <p><cite>Usage</cite>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>COPY <table name> [(<column>, ...)] FROM <file name> WITH <copy option> [AND <copy option> ...] |
| </pre></div> |
| </div> |
| <p>If no columns are specified, all columns from the CSV file will be copied to the table. A subset |
| of columns to copy may be specified by adding a comma-separated list of column names surrounded |
| by parenthesis after the table name.</p> |
| <p>The <code class="docutils literal notranslate"><span class="pre"><file</span> <span class="pre">name></span></code> should be a string literal (with single quotes) representing a path to the |
| source file. This can also the special value <code class="docutils literal notranslate"><span class="pre">STDIN</span></code> (without single quotes) to read the |
| CSV data from stdin.</p> |
| <p>See <a class="reference internal" href="#shared-copy-options"><span class="std std-ref">Shared COPY Options</span></a> for options that apply to both <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code> and <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">FROM</span></code>.</p> |
| <div class="section" id="id1"> |
| <h4>Options for <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h4> |
| <dl class="simple"> |
| <dt><code class="docutils literal notranslate"><span class="pre">INGESTRATE</span></code></dt><dd><p>The maximum number of rows to process per second. Defaults to 100000.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">MAXROWS</span></code></dt><dd><p>The maximum number of rows to import. -1 means unlimited, and is the default.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">SKIPROWS</span></code></dt><dd><p>A number of initial rows to skip. Defaults to 0.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">SKIPCOLS</span></code></dt><dd><p>A comma-separated list of column names to ignore. By default, no columns are skipped.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">MAXPARSEERRORS</span></code></dt><dd><p>The maximum global number of parsing errors to ignore. -1 means unlimited, and is the default.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">MAXINSERTERRORS</span></code></dt><dd><p>The maximum global number of insert errors to ignore. -1 means unlimited. The default is 1000.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">ERRFILE</span></code> =</dt><dd><p>A file to store all rows that could not be imported, by default this is <code class="docutils literal notranslate"><span class="pre">import_<ks>_<table>.err</span></code> where <code class="docutils literal notranslate"><span class="pre"><ks></span></code> is |
| your keyspace and <code class="docutils literal notranslate"><span class="pre"><table></span></code> is your table name.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">MAXBATCHSIZE</span></code></dt><dd><p>The max number of rows inserted in a single batch. Defaults to 20.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">MINBATCHSIZE</span></code></dt><dd><p>The min number of rows inserted in a single batch. Defaults to 2.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">CHUNKSIZE</span></code></dt><dd><p>The number of rows that are passed to child worker processes from the main process at a time. Defaults to 1000.</p> |
| </dd> |
| </dl> |
| </div> |
| <div class="section" id="shared-copy-options"> |
| <span id="id2"></span><h4>Shared COPY Options<a class="headerlink" href="#shared-copy-options" title="Permalink to this headline">¶</a></h4> |
| <p>Options that are common to both <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code> and <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">FROM</span></code>.</p> |
| <dl class="simple"> |
| <dt><code class="docutils literal notranslate"><span class="pre">NULLVAL</span></code></dt><dd><p>The string placeholder for null values. Defaults to <code class="docutils literal notranslate"><span class="pre">null</span></code>.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">HEADER</span></code></dt><dd><p>For <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code>, controls whether the first line in the CSV output file will contain the column names. For COPY FROM, |
| specifies whether the first line in the CSV input file contains column names. Defaults to <code class="docutils literal notranslate"><span class="pre">false</span></code>.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">DECIMALSEP</span></code></dt><dd><p>The character that is used as the decimal point separator. Defaults to <code class="docutils literal notranslate"><span class="pre">.</span></code>.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">THOUSANDSSEP</span></code></dt><dd><p>The character that is used to separate thousands. Defaults to the empty string.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">BOOLSTYlE</span></code></dt><dd><p>The string literal format for boolean values. Defaults to <code class="docutils literal notranslate"><span class="pre">True,False</span></code>.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">NUMPROCESSES</span></code></dt><dd><p>The number of child worker processes to create for <code class="docutils literal notranslate"><span class="pre">COPY</span></code> tasks. Defaults to a max of 4 for <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">FROM</span></code> and 16 |
| for <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code>. However, at most (num_cores - 1) processes will be created.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">MAXATTEMPTS</span></code></dt><dd><p>The maximum number of failed attempts to fetch a range of data (when using <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">TO</span></code>) or insert a chunk of data |
| (when using <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">FROM</span></code>) before giving up. Defaults to 5.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">REPORTFREQUENCY</span></code></dt><dd><p>How often status updates are refreshed, in seconds. Defaults to 0.25.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">RATEFILE</span></code></dt><dd><p>An optional file to output rate statistics to. By default, statistics are not output to a file.</p> |
| </dd> |
| </dl> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| <footer> |
| |
| <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| |
| <a href="nodetool.html" class="btn btn-neutral float-right" title="Nodetool" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> |
| |
| |
| <a href="index.html" class="btn btn-neutral float-left" title="Cassandra Tools" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> |
| |
| </div> |
| |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p> |
| © Copyright 2016, The Apache Cassandra team |
| |
| </p> |
| </div> |
| Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. |
| |
| </footer> |
| |
| </div> |
| </div> |
| |
| </section> |
| |
| </div> |
| |
| |
| |
| <script type="text/javascript"> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |