Chalk SQL supports statements for querying data, inspecting schemas and query plans, writing query results, and managing scheduled jobs.

StatementDescription
SELECTQuery data from data sources, the offline store, and the Chalk catalog
DESCRIBE / SHOWInspect the schema of a table or query, or list available tables
EXPLAINShow the physical plan for a statement, optionally with execution statistics
CREATE TABLECreate an empty table or save query results as a table
INSERT INTOAppend literal rows or query results to an existing table
COPY ... TOWrite the result of a query to Parquet, CSV, or Iceberg files
MERGE INTOUpdate and insert rows into an Iceberg table
CREATE DATASETSave query results as a dataset revision
Job statementsCreate, alter, drop, and run scheduled jobs

The Chalk SQL function reference documents the scalar and aggregate functions available in Chalk SQL. For table-valued functions, query chalk.information_schema.functions, whose is_table_valued column marks them.

To count rows in a query result, wrap the query in a subquery.

result
SELECT
  count(*) AS order_count
FROM
  (
    VALUES
      (101),
      (102),
      (103)
  ) AS orders (order_id);
order_count
3

​
Syntax notation

  • Uppercase words are SQL keywords. Replace placeholders such as <table_name> with your own values.
  • Square brackets ([ ]) enclose optional syntax.
  • Braces ({ }) enclose required alternatives. A vertical bar (|) separates choices.
  • An ellipsis (...) indicates repetition. For example, <column> [, ...] means one or more comma-separated columns.

​
General rules

  • One statement per query. Each Chalk SQL request executes exactly one statement. Submitting multiple ;-separated statements returns an error.
  • Supported syntax. Each statement page documents the syntax and restrictions that Chalk SQL supports. For expression syntax, such as literals, struct and list access, CASE, and casts, see Expressions. For named functions, see the Chalk SQL function reference.
  • Fully qualify catalog tables. Use catalog.schema.table for Chalk catalog tables and configured data sources, for example SELECT * FROM chalk.online_store.keys. Quote individual identifiers when required. See Referencing the Chalk Catalog.