Skip to main content
Version: 0.8.2

Using the REPL

Once you've set up Skytable following our guide, you can now get started using the REPL. Note that you must have downloaded the bundle. If not, go back to the installation guide and do it now.

Starting the repl

Run this to start the command-line REPL:

./skysh

The REPL will then ask you for a password which you need to type in. This is the root password that you would have set during your installation, so if you don't remember it go ahead and check what you set during the installation step.

tip

Keep the root password safe! It's the admin access to your database and without it you won't be able to create or drop or alter or ... do anything administrative. But if you do happen to lose it, there's an easy way to reset the password (this however requires you to stop the database, which is also the case with many other databases, and that's primarily for security).

You can read more in the configuration page.

Using the REPL

You will now see a welcome message and the REPL will prompt you to run something. Now is a good time to run sysctl report status which should just print out (Okay) in a cyan shade:

> sysctl report status
(Okay)

You can also run queries like: inspect global to see available global system information.

Quick notes
  • The REPL stores all command history in a file located at $HOME/.sky_history (here $HOME represents your home directory)
  • If you wish to change where the REPL stores the history file, set the SKYSH_HISTORY_FILE environment variable to your preferred path
  • The REPL will automatically parameterize queries. Don't worry about what this means; you'll learn about it ahead.
  • The REPL applies custom formatting to DDL queries. For example, even though inspect global returns a JSON as a string, the REPL formats it and outputs it without quotes, to improve readability
  • To connect using different settings (the REPL will attempt to authenticate as root by default), see the options using skysh --help

First steps

Skytable's data model is discussed in depth on this page, but let us understand some basics. If you've used a SQL database, you would be used to the idea of a database — just like this, Skytable has spaces. A space is a collection of models (which are like SQL's tables with slightly different functionality) and other containers.

Create a space

Let us create a space:

CREATE SPACE myspace

Create a model

Let us create a model. We want to store something that resembles the structure:

{"username": "string username", "password": "string password", "notes": []}

To do this, we create the following Skytable model:

CREATE MODEL myspace.mymodel(username: string, password: string, notes: list { type: string })

Add, update and remove some data

  • Insert some data:
      INSERT INTO myspace.mymodel('sayan', 'password123', [])
  • Update some data:
    UPDATE myspace.mymodel SET notes += "mynewnote" WHERE username = 'sayan'
  • Select some data:
    SELECT notes, password FROM myspace.mymodel WHERE username = 'sayan'

Use in your own apps

While we would recommend you to learn BlueQL and more about Skytable's architecture by using the REPL, you can always start using Skytable in your own apps. Find a client driver for your language or framework here.

Once you've found the driver for your framework, you can come back here and follow on with the guide. Be sure to check the driver's documentation to see how the client driver should be used.

Good luck!