Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
eb2b574
Improve the SQL reference
lukekim May 7, 2025
8b1f050
Tweaks
lukekim May 7, 2025
2e49b06
Remove extra reference
lukekim May 7, 2025
ba6def5
Fix v1.2.1
lukekim May 7, 2025
d0057d7
Fix headings
lukekim May 7, 2025
2a1a3cb
Tweaks
lukekim May 7, 2025
aad40b0
fix: SQL reference sidebar link
peasee May 12, 2025
fe83e1c
fix: Remove leading slash
peasee May 12, 2025
750c35b
fix: Remove index.md from path
peasee May 12, 2025
fae84a9
Merge branch 'trunk' into lukim/scalar-functions
lukekim May 19, 2025
ae49e6b
Merge branch 'trunk' into lukim/scalar-functions
lukekim May 26, 2025
bb96007
WIP
lukekim May 27, 2025
42c6742
Merge branch 'trunk' into lukim/scalar-functions
lukekim Jul 22, 2025
02930dd
Merge branch 'trunk' into lukim/scalar-functions
lukekim Aug 12, 2025
1360304
Link updates
lukekim Aug 12, 2025
e443277
Merge branch 'trunk' into lukim/scalar-functions
lukekim Aug 12, 2025
d2419d2
Merge branch 'trunk' into lukim/scalar-functions
lukekim Aug 20, 2025
a284fbb
Fix links
lukekim Aug 20, 2025
1484b68
Fix link
lukekim Aug 20, 2025
c41966c
Fix link again
lukekim Aug 20, 2025
ffefe7e
Fix more links
lukekim Aug 20, 2025
84b5ffc
Fix links
lukekim Aug 20, 2025
b7b4c03
Upgrade Wrangler
lukekim Aug 20, 2025
c816f84
Use Node 24
lukekim Aug 20, 2025
00467f4
Fix edit path
lukekim Aug 20, 2025
177ab5b
Remove shallow fetch
lukekim Aug 20, 2025
55aabd4
Upgrade packages
lukekim Aug 20, 2025
dc13ebf
Fix casing
lukekim Aug 20, 2025
2fb21c9
Merge branch 'trunk' into lukim/scalar-functions
lukekim Aug 20, 2025
f5c0a8a
Add search to the SQL reference
lukekim Aug 20, 2025
ec48570
Fix functions
lukekim Aug 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions website/docs/reference/sql/explain.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@ sidebar_position: 5
Spice is built on [Apache DataFusion](https://datafusion.apache.org/) and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects.
:::

# EXPLAIN

The `EXPLAIN` command shows the logical and physical execution plan of a SQL statement.

<pre>
EXPLAIN [ANALYZE] [VERBOSE] statement
</pre>
`EXPLAIN [ANALYZE] [VERBOSE] statement`

Shows the execution plan of a statement.
Use `EXPLAIN VERBOSE` if more detailed output is needed.

```
```sql
EXPLAIN SELECT SUM(x) FROM table GROUP BY b;
+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan |
Expand All @@ -45,7 +41,7 @@ EXPLAIN SELECT SUM(x) FROM table GROUP BY b;
Shows the execution plan of a statement.
Use `EXPLAIN ANALYZE VERBOSE` if more detailed output is needed.

```
```sql
EXPLAIN ANALYZE SELECT SUM(x) FROM table GROUP BY b;
+-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan |
Expand Down
71 changes: 69 additions & 2 deletions website/docs/reference/sql/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,73 @@ sidebar_position: 2
pagination_next: null
---

import DocCardList from '@theme/DocCardList';
This section provides a comprehensive reference for SQL support in Spice.ai, including syntax, data types, operators, functions, and system features. The reference is organized by topic for ease of navigation.

<DocCardList />
## Table of Contents

### [SELECT Syntax](/docs/reference/sql/select)

- [WITH Clause](/docs/reference/sql/select#with-clause)
- [SELECT Clause](/docs/reference/sql/select#select-clause)
- [FROM Clause](/docs/reference/sql/select#from-clause)
- [WHERE Clause](/docs/reference/sql/select#where-clause)
- [JOIN Clause](/docs/reference/sql/select#join-clause)
- [GROUP BY Clause](/docs/reference/sql/select#group-by-clause)
- [HAVING Clause](/docs/reference/sql/select#having-clause)
- [UNION Clause](/docs/reference/sql/select#union-clause)
- [ORDER BY Clause](/docs/reference/sql/select#order-by-clause)
- [LIMIT Clause](/docs/reference/sql/select#limit-clause)
- [EXCLUDE and EXCEPT Clause](/docs/reference/sql/select#exclude-and-except-clause)

### [Subqueries](/docs/reference/sql/subqueries)

- [Subquery Operators](/docs/reference/sql/subqueries#subquery-operators)
- [SELECT Clause Subqueries](/docs/reference/sql/subqueries#select-clause-subqueries)
- [FROM Clause Subqueries](/docs/reference/sql/subqueries#from-clause-subqueries)
- [WHERE Clause Subqueries](/docs/reference/sql/subqueries#where-clause-subqueries)
- [HAVING Clause Subqueries](/docs/reference/sql/subqueries#having-clause-subqueries)
- [Subquery Categories](/docs/reference/sql/subqueries#subquery-categories)

### [EXPLAIN](/docs/reference/sql/explain)

- [Syntax](/docs/reference/sql/explain#explain)
- [EXPLAIN](/docs/reference/sql/explain#explain)
- [EXPLAIN ANALYZE](/docs/reference/sql/explain#explain-analyze)

### [Information Schema](/docs/reference/sql/information_schema)

- [SHOW TABLES](/docs/reference/sql/information_schema#show-tables)
- [SHOW COLUMNS](/docs/reference/sql/information_schema#show-columns)
- [SHOW ALL (configuration options)](/docs/reference/sql/information_schema#show-all-configuration-options)
- [SHOW FUNCTIONS](/docs/reference/sql/information_schema#show-functions)

### [Operators and Literals](/docs/reference/sql/operators)

- [Numerical Operators](/docs/reference/sql/operators#numerical-operators)
- [Comparison Operators](/docs/reference/sql/operators#comparison-operators)
- [Logical Operators](/docs/reference/sql/operators#logical-operators)
- [Bitwise Operators](/docs/reference/sql/operators#bitwise-operators)
- [Other Operators](/docs/reference/sql/operators#other-operators)
- [Literals](/docs/reference/sql/operators#literals)

### [Scalar Functions](/docs/reference/sql/scalar_functions)

- [Math Functions](/docs/reference/sql/scalar_functions#math-functions)
- [Conditional Functions](/docs/reference/sql/scalar_functions#conditional-functions)
- [String Functions](/docs/reference/sql/scalar_functions#string-functions)
- [Binary String Functions](/docs/reference/sql/scalar_functions#binary-string-functions)
- [Regular Expression Functions](/docs/reference/sql/scalar_functions#regular-expression-functions)
- [Time and Date Functions](/docs/reference/sql/scalar_functions#time-and-date-functions)
- [Array Functions](/docs/reference/sql/scalar_functions#array-functions)
- [Struct Functions](/docs/reference/sql/scalar_functions#struct-functions)
- [Map Functions](/docs/reference/sql/scalar_functions#map-functions)
- [Hashing Functions](/docs/reference/sql/scalar_functions#hashing-functions)
- [Union Functions](/docs/reference/sql/scalar_functions#union-functions)
- [Other Functions](/docs/reference/sql/scalar_functions#other-functions)

### [Prepared Statements](/docs/reference/sql/prepared_statements)

- [Inferred Types](/docs/reference/sql/prepared_statements#inferred-types)
- [Positional Arguments](/docs/reference/sql/prepared_statements#positional-arguments)

Refer to each section for detailed syntax, supported features, and examples.
4 changes: 1 addition & 3 deletions website/docs/reference/sql/information_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
title: 'Information Schema'
sidebar_label: 'Information Schema'
pagination_prev: 'reference/sql/explain'
pagination_next: null
pagination_next: 'reference/sql/scalar_functions'
sidebar_position: 5
---

:::info
Spice is built on [Apache DataFusion](https://datafusion.apache.org/) and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects.
:::

# Information Schema

Spice supports display metadata about available tables and views. This information is accessible through the ISO SQL `information_schema` schema or the `SHOW TABLES` and `SHOW COLUMNS` commands.

## `SHOW TABLES`
Expand Down
2 changes: 0 additions & 2 deletions website/docs/reference/sql/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ sidebar_position: 2
Spice is built on [Apache DataFusion](https://datafusion.apache.org/) and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects.
:::

# Operators

## Numerical Operators

- [+ (plus)](#op_plus)
Expand Down
7 changes: 6 additions & 1 deletion website/docs/reference/sql/prepared_statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ pagination_next: 'reference/sql/explain'
sidebar_position: 4
---

:::info
Spice is built on [Apache DataFusion](https://datafusion.apache.org/) and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects.
:::

## Positional Arguments

Prepared statements can use positional arguments to support multiple parameters. Each parameter is referenced by its position in the statement.
Expand Down Expand Up @@ -36,8 +40,9 @@ with adbc_driver_flightsql.dbapi.connect("grpc://localhost:50051") as conn:
result = cur.fetchall()
print(result)
```

:::warning[Limitations]

* Positional arguments are not supported with the `date` keyword to construct a date value, like `date $1`. Specify the date value in the query instead: `l_shipdate > date '1995-01-01'`.
- Positional arguments are not supported with the `date` keyword to construct a date value, like `date $1`. Specify the date value in the query instead: `l_shipdate > date '1995-01-01'`.

:::
Loading
Loading