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:
```
- CREATE KEYSPACE
``` - 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
(modelargs) ``` - 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
``` - 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
``` - 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:
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 yourtablenameoryourkeyspacename:yourtablename
USE
Keyspaces
- Time complexity: O(1)
- Transactional: Not applicable
- Syntax:
```
- USE
``` - 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
``` - 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
