StackQL’s lexical structure and grammar is modelled upon MySQL’s language implementation (an adaptation of the ANSI SQL-92 standard) with some extensions. StackQL statements are used to query cloud resources (using
SELECT grammar) or create, modify or delete infrastructure using standard Data Manipulation Language (DML) statements such as
DELETE. Additionally, non DML operations such as starting an instance, or getting or putting an object into a bucket in AWS S3 for example are implemented as built-in provider procedures (akin to Stored Procedures in a DBMS). Built-in provider procedures are invoked using the
StackQL’s SQL domain-specific language allows for declarative as well as procedural infrastructure programming.
StackQL operations are comprised of one or more semicolon (
;) terminated statements. Statements include keywords, identifiers, parameters and values, an example StackQL statement used to create a 10GB disk in GCP would be:
INSERT INTO google.compute.disks (project, zone, name, sizeGb)
SELECT 'myProject', 'australia-southeast1-a', 'my10GbDisk', 10;
In the above example,
SELECT are keywords, google.compute.disks is an identifier, project, zone, name, sizeGb are parameters, and 'myProject', 'australia-southeast1-a', 'my10GbDisk', 10 are values.
Keywords are not case sensitive, meaning
insert are treated equivalently, however they are often capitalized by convention. A complete list of keywords can be found in the Keywords section.
Identifiers are symbols that represent objects in a cloud provider resource hierarchy. Identifiers are made up of multiple parts, more information on identifiers can be found in the StackQL Resource Hierarchy topic.
Parameters and Values
Parameters are specified by the resource; these can be found by using a
DESCRIBE statement for a given cloud provider resource. Values are typed scalar or complex objects which map to parameters. For more information on parameters and values, see the
DESCRIBE and Data Types topics.
StackQL supports multi-line and in line comments within StackQL statements, examples of comments are shown below:
--This is an inline comment