Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update alternative query languages page to include Kusto #2404

Merged
Merged
Changes from all commits
Commits
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
55 changes: 51 additions & 4 deletions docs/en/guides/developer/alternative-query-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,36 @@ title: Alternative Query Languages
description: Use alternative query languages in ClickHouse
---

You can use other query languages to query data in ClickHouse using the `dialect` setting. The currently supported dialects are:
You can use other query languages to query data in ClickHouse using the `dialect` setting.
After changing `dialect`, you can run queries in the newly configured dialect.

The currently supported dialects are:
- `clickhouse`: The default [ClickHouse SQL dialect](../../sql-reference/syntax.md)

Experimental dialects:
- `prql`: [Pipelined Relational Query Language](https://prql-lang.org/)
- `kusto`: [Kusto Quey Language (KQL)](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query)

### ClickHouse SQL

The default SQL dialect for ClickHouse.

```sql
SET dialect = 'clickhouse'
```

## Experimental Dialects

These dialects may not be fully supported or have all of the features of their original specification.

### Pipelined Relational Query Language (PRQL)

You can execute queries using the PRQL language after setting the dialect to `prql`:
```sql
SET dialect = 'prql'
```

Then you can use every PRQL feature that the included PRQL compiler supports:
Then you can use every PRQL feature that the included compiler supports:

```prql
from trips
Expand All @@ -24,7 +44,34 @@ aggregate {
}
```

Under the hood ClickHouse will translate the PRQL query into an SQL query and execute it. To switch back to the ClickHouse SQL dialect set the dialect to `clickhouse`:
Under the hood ClickHouse will translate the PRQL query into an SQL query and execute it.

### Kusto Query Language (KQL)

Kusto may not be able to access all functions defined in ClickHouse.

Enable Kusto:
```sql
SET dialect = 'clickhouse'
SET dialect = 'kusto'
```

Example query that selects from `system.numbers(10)`:
```sql
numbers(10) | project number
```

```sql
┌─number─┐
│ 0 │
│ 1 │
│ 2 │
│ 3 │
│ 4 │
│ 5 │
│ 6 │
│ 7 │
│ 8 │
│ 9 │
└────────┘
```