Actions and Querying

Actions are exactly what they say — they do something! You can think of actions to be like shell commands: you run a command with arguments and you get some corresponding output.
In this document we’ll explore actions, or what you may call queries. We’ll also explore the different kinds of queries that you can use with Skytable.

Remember the HEYA you ran in the earlier document? Yup, that’s an action. All kind of quering in Skytable is done through actions. Actions are classified into two kinds:

  • DDL (Data definition language) Actions: These actions enable us to interact with the structures that store our data
  • DML (Data manipulation language) Actions: These actions enable us to access and manipulate the data stored in our database

Taking action

If you’re coming from a SQL background, you might be used to the DML way of things. That’s right, DML actions are similar. Let us try out a few basic DML actions (don’t worry — you’ll learn about DDL in the next few documents).

SET

The SET action lets us assign a key to a value (in a key/value table). For example:

  1. SET x 100

will assign the key x to 100. But how do we get it?

GET

The GET action lets us fetch keys. For example:

  1. GET x

will return the 100 that we set in the last step.

UPDATE

The UPDATE action lets us update the values of keys. For example:

  1. UPDATE x 200

will update the value of x to 200

DEL

The DEL action lets us remove keys from the database. For example:

  1. DEL x

will remove the key x from the database.

Didn’t we just do a Create-Read-Update-Delete? The infamous CRUD! Now that you know some basic actions, you can take a look at the full index of actions.

Types of queries

Simple queries

Simple queries are, well simple! You run a single action and there — you ran a simple query.

Pipelined queries

Pipelined queries or simply pipelines enable clients to send multiple queries to the database server at once. Responses for every query is returned in the order they query was sent. For example if you sent four queries like:

  1. heya once
  2. heya twice
  3. heya thrice
  4. heya finally

Then you’d get the echos in the following order:

  1. "once"
  2. "twice"
  3. "thrice"
  4. "finally"

Hence, the responses are returned in the order queries were issued.

Limitations

Pipelines provide no transactional guarantees and hence shouldn’t be relied on for the same.

Batches

Batches are currently in the decision phase but aim to provide a way to overcome the limitations imposed by pipelines, hence providing stronger guarantees. If you have any ideas, drop an issue here and we’ll be happy to consider it!