Skip to content

Commit

Permalink
Move the PRQL docs to a better place
Browse files Browse the repository at this point in the history
  • Loading branch information
antaljanosbenjamin committed Jul 20, 2023
1 parent 3e9d835 commit 36a21af
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
29 changes: 29 additions & 0 deletions docs/en/guides/developer/alternative-query-languages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
slug: /en/guides/developer/alternative-query-languages
sidebar_label: Alternative Query Languages
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:
- `clickhouse`: The default [ClickHouse SQL dialect](../../sql-reference/syntax.md)
- `prql`: [Pipelined Relational Query Language](https://prql-lang.org/)

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:

```prql
from trips
aggregate [
ct = count
]
```

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`:
```sql
SET dialect = 'clickhouse'
```
25 changes: 0 additions & 25 deletions docs/en/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,31 +487,6 @@ Let's write some queries that join the `taxi_zone_dictionary` with your `trips`
LIMIT 1000
```

## 6. Alternative Query Languages

You can use other query languages to query data in ClickHouse using the `dialect` setting. The currently supported dialects are:
- `clickhouse`: The default [ClickHouse SQL dialect](./sql-reference/syntax.md)
- `prql`: [Pipelined Relational Query Language](https://prql-lang.org/)

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

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

```prql
from trips
aggregate [
ct = count
]
```

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`:
```sql
SET dialect = 'clickhouse'
```

#### Congrats!

Well done - you made it through the tutorial, and hopefully you have a better understanding of how to use ClickHouse. Here are some options for what to do next:
Expand Down
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const sidebars = {
'en/sql-reference/dictionaries/index',
'en/guides/developer/lightweight-delete',
'en/sql-reference/transactions',
'en/guides/developer/alternative-query-languages',
],
},
{
Expand Down

0 comments on commit 36a21af

Please sign in to comment.