DDL

DDL or Data Definition Language is a way to interact with containers. Skytable lets you interact with containers with the following DDL actions:

  • CREATE to create containers
  • USE to switch to containers and run actions in them
  • INSPECT to inspect containers
  • DROP to delete containers

CREATE

Keyspaces

  • Time complexity: O(1)
  • Transactional: Not yet
  • Syntax:

    1. CREATE KEYSPACE <name>
  • Returns:

    • Okay if the keyspace was created
    • err-already-exists if it already existed
    • server error if something unpredictable has happened on the server side

Tables

  • Time complexity: O(1)
  • Transactional: Not yet
  • Syntax:

    1. CREATE TABLE <entity> <model>(modelargs) <properties>
  • Returns:

    • Okay if the table was created
    • err-already-exists if it already existed
    • default-container-unset if the connection level default keyspace has not been set
    • server error if something unpredictable has happened on the server side
  • Refer to the model section to know what to pass for <model> and modelargs
  • Refer to the table properties section to know what to pass for properties
  • Refer to the entity section to know what to pass for entity. It is simply your tablename or yourkeyspacename:yourtablename

DROP

Keyspaces

  • Time complexity: O(1)
  • Transactional: Not yet
  • Syntax:

    1. DROP KEYSPACE <name>
  • Returns:

    • Okay if the keyspace was deleted
    • container-not-found if the keyspace wasn’t found
    • still-in-use if clients are still connected to the keyspace or the keyspace is not empty
    • server error if something unpredictable has happened on the server side

Tables

  • Time complexity: O(1)

  • Transactional: Not yet

  • Syntax:

    1. DROP TABLE <entity>
  • Returns:

    • Okay if the table was deleted
    • container-not-found if the keyspace wasn’t found
    • still-in-use if clients are still connected to the table
    • default-container-unset if the connection level default keyspace has not been set
    • server error if something unpredictable has happened on the server side
  • Refer to the entity section to know what to pass for entity. It is simply your tablename or yourkeyspacename:yourtablename

INSPECT

Entire database

To inspect the entire database, run:

  1. INSPECT KEYSPACES

This will return a flat array with all the keyspace names

Keyspaces

To inspect a keyspace, run:

  1. INSPECT KEYSPACE <name>

This will return a flat array with all the table names

Tables

To inspect a table, run:

  1. INSPECT TABLE <entity>

This will return a string with the table’s syntactical description. For example, the keymap model can return:

  1. Keymap { data: (binstr,binstr), volatile: true }
  • Refer to the entity section to know what to pass for entity. It is simply your tablename or yourkeyspacename:yourtablename

USE

Keyspaces

  • Time complexity: O(1)
  • Transactional: Not applicable
  • Syntax:

    1. USE <keyspace_name>
  • Returns:

    • Okay if the keyspace was switched
    • container-not-found if the keyspace wasn’t found

Tables

  • Time complexity: O(1)

  • Transactional: Not applicable

  • Syntax:

    1. USE <entity>
  • Returns:

    • Okay if the table was switched
    • container-not-found if the keyspace wasn’t found
    • default-container-unset if the connection level default keyspace has not been set
  • Refer to the entity section to know what to pass for entity. It is simply your tablename or yourkeyspacename:yourtablename