blob: 05b9006e40ffb708ee38d974ed3e4950472caea5 [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Inserting and querying &mdash; Apache Cassandra Documentation v4.0-rc2</title>
<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" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Client drivers" href="drivers.html" />
<link rel="prev" title="Configuring Cassandra" href="configuring.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">
4.0-rc2
</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 current"><a class="reference internal" href="index.html">Getting Started</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="installing.html">Installing Cassandra</a></li>
<li class="toctree-l2"><a class="reference internal" href="configuring.html">Configuring Cassandra</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Inserting and querying</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cqlsh">CQLSH</a></li>
<li class="toctree-l3"><a class="reference internal" href="#client-drivers">Client drivers</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="drivers.html">Client drivers</a></li>
<li class="toctree-l2"><a class="reference internal" href="production.html">Production Recommendations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../new/index.html">New Features in Apache Cassandra 4.0</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="../cql/index.html">The Cassandra Query Language (CQL)</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="../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"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></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">Contributing to Cassandra</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="../plugins/index.html">Third-Party Plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs</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" class="icon icon-home"></a> &raquo;</li>
<li><a href="index.html">Getting Started</a> &raquo;</li>
<li>Inserting and querying</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/getting_started/querying.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="inserting-and-querying">
<h1>Inserting and querying<a class="headerlink" href="#inserting-and-querying" title="Permalink to this headline"></a></h1>
<p>The API to Cassandra is <a class="reference internal" href="../cql/index.html#cql"><span class="std std-ref">CQL</span></a>, the Cassandra Query Language. To use CQL, you will need to connect to the
cluster, which can be done:</p>
<ul class="simple">
<li><p>either using cqlsh,</p></li>
<li><p>or through a client driver for Cassandra.</p></li>
</ul>
<div class="section" id="cqlsh">
<h2>CQLSH<a class="headerlink" href="#cqlsh" title="Permalink to this headline"></a></h2>
<p>cqlsh is a command line shell for interacting with Cassandra through CQL. It is shipped with every Cassandra package,
and can be found in the bin/ directory alongside the cassandra executable. It connects to the single node specified on
the command line. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ bin/cqlsh localhost
Connected to Test Cluster at localhost:9042.
[cqlsh 5.0.1 | Cassandra 3.8 | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
cqlsh&gt; SELECT cluster_name, listen_address FROM system.local;
cluster_name | listen_address
--------------+----------------
Test Cluster | 127.0.0.1
(1 rows)
cqlsh&gt;
</pre></div>
</div>
<p>See the <a class="reference internal" href="../tools/cqlsh.html#cqlsh"><span class="std std-ref">cqlsh section</span></a> for full documentation.</p>
</div>
<div class="section" id="client-drivers">
<h2>Client drivers<a class="headerlink" href="#client-drivers" title="Permalink to this headline"></a></h2>
<p>A lot of client drivers are provided by the Community and a list of known drivers is provided in <a class="reference internal" href="drivers.html#client-drivers"><span class="std std-ref">the next section</span></a>. You should refer to the documentation of each drivers for more information on how to use them.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="drivers.html" class="btn btn-neutral float-right" title="Client drivers" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="configuring.html" class="btn btn-neutral float-left" title="Configuring Cassandra" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2020, The Apache Cassandra team.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/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>