DDL
DDL or Data Definition Language is a way to interact with containers. Skytable lets you interact with containers with the following DDL actions:
CREATEto create containersUSEto switch to containers and run actions in themINSPECTto inspect containersDROPto delete containers
CREATE
Keyspaces
- Time complexity: O(1)
- Transactional: Not yet
- Syntax:
CREATE KEYSPACE <name> - Returns:
- Okay if the keyspace was created
err-already-existsif it already existed- server error if something unpredictable has happened on the server side
Tables
- Time complexity: O(1)
- Transactional: Not yet
- Syntax:
CREATE TABLE <entity> <model>(modelargs) <properties> - Returns:
- Okay if the table was created
err-already-existsif it already existeddefault-container-unsetif 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>andmodelargs - 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 yourtablenameoryourkeyspacename:yourtablename
DROP
Keyspaces
- Time complexity: O(1)
- Transactional: Not yet
- Syntax:
DROP KEYSPACE <name> - Returns:
- Okay if the keyspace was deleted
container-not-foundif the keyspace wasn't foundstill-in-useif 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:
DROP TABLE <entity> -
Returns:
- Okay if the table was deleted
container-not-foundif the keyspace wasn't foundstill-in-useif clients are still connected to the tabledefault-container-unsetif 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 yourtablenameoryourkeyspacename:yourtablename
INSPECT
Entire database
To inspect the entire database, run:
INSPECT KEYSPACES
This will return a flat array with all the keyspace names
Keyspaces
To inspect a keyspace, run:
INSPECT KEYSPACE <name>
This will return a flat array with all the table names
Tables
To inspect a table, run:
INSPECT TABLE <entity>
This will return a string with the table's syntactical description. For example, the keymap model can return:
Keymap { data: (binstr,binstr), volatile: true }
- Refer to the entity section to know what to pass for
entity. It is simply yourtablenameoryourkeyspacename:yourtablename
USE
Keyspaces
- Time complexity: O(1)
- Transactional: Not applicable
- Syntax:
USE <keyspace_name> - Returns:
- Okay if the keyspace was switched
container-not-foundif the keyspace wasn't found
Tables
-
Time complexity: O(1)
-
Transactional: Not applicable
-
Syntax:
USE <entity> -
Returns:
- Okay if the table was switched
container-not-foundif the keyspace wasn't founddefault-container-unsetif the connection level default keyspace has not been set
-
Refer to the entity section to know what to pass for
entity. It is simply yourtablenameoryourkeyspacename:yourtablename