Chalk SQL
The SQL statements supported by Chalk SQL.
Chalk SQL supports statements for querying data, inspecting schemas and query plans, writing query results, and managing scheduled jobs.
| Statement | Description |
|---|---|
SELECT | Query data from data sources, the offline store, and the Chalk catalog |
DESCRIBE / SHOW | Inspect the schema of a table or query, or list available tables |
EXPLAIN | Show the physical plan for a statement, optionally with execution statistics |
CREATE TABLE | Create an empty table or save query results as a table |
INSERT INTO | Append literal rows or query results to an existing table |
COPY ... TO | Write the result of a query to Parquet, CSV, or Iceberg files |
MERGE INTO | Update and insert rows into an Iceberg table |
CREATE DATASET | Save query results as a dataset revision |
| Job statements | Create, 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.
SELECT
count(*) AS order_count
FROM
(
VALUES
(101),
(102),
(103)
) AS orders (order_id);| order_count |
|---|
| 3 |
<table_name> with your own values.[ ]) enclose optional syntax.{ }) enclose required alternatives. A vertical bar (|) separates choices....) indicates repetition. For example, <column> [, ...] means one or more comma-separated columns.;-separated statements returns an error.CASE, and casts, see
Expressions. For named functions, see the
Chalk SQL function reference.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.