Overview
BlueQLTM is Skytable's own query language that very closely follows the design of SQL but with many modern features and superior security. This document explores a basic overview of BlueQL.
Design principles:
- Simplicity and clarity: The language shouldn't be overwhelming to understand
- Security with mandatory parameterization: We want to reduce the surface of injection attacks. For this reason, parameterization is mandatory.
Just like SQL, BlueQL has three categories of commands/queries inside it:
- DDL: Data definition language is used to define, modify and/or remove DDL objects such as
space
s andmodel
s - DCL: Data control language is used to control the access to data, and perform other administrative tasks
- DML: Data manipulation language is used to manipulate data
Jump to differences from SQL.
This text is not a detailed, formal guide. It's meant for developers and users who want to work with Skytable. If you need a more formal specification, like a grammar definition, please ask us, and we'll create it. We haven't published it yet because no one has requested it.
Identifiers
Can begin with any ASCII alphabet or an underscore (_
) and then have any number of alphanumeric characters and/or underscores.
Keywords
Keywords are identifiers with special meanings and hence can't be used as identifiers in other places. Here's a full-list of keywords:
[
"sysctl", "create", "alter", "drop", "use", "inspect", "describe", "insert", "select", "update",
"delete", "exists", "table", "model", "space", "index", "type", "function", "rename", "add",
"remove", "transform", "set", "return", "order", "sort", "group", "limit", "asc", "desc", "all",
"by", "with", "on", "from", "into", "as", "to", "in", "of", "and", "or", "not", "if", "else",
"where", "when", "allow", "auto", "default", "null", "transaction", "batch", "lock", "read",
"write", "begin", "end", "key", "value", "primary", "truncate"
]
Data types
Boolean
A boolean value, either true
or false
Unsigned integers
uint8
: unsigned 8-bit integeruint16
: unsigned 16-bit integeruint32
: unsigned 32-bit integeruint64
: unsigned 64-bit integer
Signed integers
sint8
: signed 8-bit integersint16
: signed 16-bit integersint32
: signed 32-bit integersint64
: signed 64-bit integer
Floating point values
float32
: a single-precision floatfloat64
: a double-precision float
Simple collections
binary
: a binary blob represented as a sequence ofuint8
valuesstring
: an UTF-8 string
Complex collections
list
: a list of any of the data types, including nested lists- A list is represented as:
[]
with values inbetween. For example, alist { type:string }
would be represented as:["sayan", "loves", "dogs"]
- Lists cannot contain null values
- List can be nested: You can have heavily nested lists like:
[[[]], [["another one"]]]
- List can only have one base type: This means that if you have a list like
[[[string]]]
each element must either be the same nested list, or an empty list
- A list is represented as:
New data types are frequently added, so treat this list as non-exhaustive.
Literals
- Null literal:
null
- Numeric literals:
- Unsigned:
1234
- Signed:
[-]1234
- Unsigned:
- Floating point literals:
[-]1234.5678
- String literals:
"hello"
- Binary literals: `binary`
- List literals:
[..]
- Dictionaries:
{<ident>: <literal>}
It is very important for you to know that literals are not allowed everywhere. The only literals allowed everywhere are:
- Lists
- Dictionaries
Read below to understand why.