Explore Sample Data with Data Tools

  • tutorial
    Use Couchbase Capella’s Data Tools to explore and work with your data.

    Your trial database includes a travel-sample bucket, which you can use to try out Capella’s Data Tools. The sample bucket contains documents used for booking travel.

    To start exploring your sample data, you can:

    View and Edit Documents with the Documents Viewer

    Capella groups documents in buckets. You can add scopes and collections to a bucket to group related documents together. For more information about buckets, scopes, and collections, see Buckets, Scopes, and Collections.

    To view and edit a document in your database:

    1. Go to Data Tools  Documents.

    2. In the Get documents from section, select:

      • travel-sample in the Bucket list

      • inventory in the Scope list

      • airport in the Collection list

    3. In the Paginate and Filter documents section, change the Limit field to 8 to specify the maximum number of documents to return.

    4. Click Get Documents to update the returned document list.

    5. In the documents table, click airport_1261.

    6. In the Edit Document dialog, change the city from "Amiens" to "Rouen" and click Save Document.

    You have now updated the city of the document airport_1261 to "Rouen".

    Run Your First Query with the Query Tab

    You can use the Query tab to run SQL++ queries.

    To run your first query:

    1. Go to Data Tools  Query.

    2. In the query editor, replace the existing text with the following query:

      SELECT route.airlineid, airline.name, route.sourceairport, route.destinationairport
      FROM `travel-sample` route
      INNER JOIN `travel-sample` airline
      ON route.airlineid = META(airline).id
      WHERE route.type = "route"
      AND route.destinationairport = "SFO"
      ORDER BY route.sourceairport;
    3. Press Enter or click Run. The query results are automatically displayed in JSON format.

    Capella can also display the query results as a table, chart, plan, and plan text.

    To display the results in the format of a data-flow diagram with query operators, select the Plan tab. The initial scans are on the right of the diagram and the final query output is on the left.

    The query results highlight the operators that might use a lot of resources. For example, Capella spends almost 90% of the time on the Fetch operator when running your query.

    For more information about the tools on the Query tab, see Query Tab.

    Speed Up Your Query with an Index

    You can use indexes to improve the performance of your queries.

    After you run your query in the query editor, click Build Suggested under Suggested Covered Indexes on the Index Advice right pane. Capella generates an index for you called adv_destinationairport_sourceairport_airlineid_type. If you run your query again, the query execution time changes from around 172ms to 24ms.

    For more information about indexes in Capella, see Primary and Secondary Index Reference.

    Access Your Query History

    You can use your query history to load earlier queries into your query editor.

    To acess your query history:

    1. Click Recent Queries.

    2. Select a query from your query history on the right pane.

    3. Click Run to run the query again.

    Next Steps

    After you run your first query, you can:

    If you want to connect to your database:

    1. Generate your database credentials to connect and control access to you database.

    2. Add your current IP address as an allowed IP for you database.

    3. Generate a code snippet to connect your database to your application.

    4. Choose and install a Couchbase SDK.

    5. (Optional) Download the security certificate for your database and add it to your application’s server machine or IDE:

      1. In the Databases tab, select a database.

      2. Go to Settings  Security Certificate.

      3. Click Download.