From 36a21af93a8fc11b584f18690a605eb239f206d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Thu, 20 Jul 2023 10:51:05 +0000 Subject: [PATCH] Move the PRQL docs to a better place --- .../developer/alternative-query-languages.md | 29 +++++++++++++++++++ docs/en/tutorial.md | 25 ---------------- sidebars.js | 1 + 3 files changed, 30 insertions(+), 25 deletions(-) create mode 100644 docs/en/guides/developer/alternative-query-languages.md diff --git a/docs/en/guides/developer/alternative-query-languages.md b/docs/en/guides/developer/alternative-query-languages.md new file mode 100644 index 00000000000..97077dd9154 --- /dev/null +++ b/docs/en/guides/developer/alternative-query-languages.md @@ -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' +``` diff --git a/docs/en/tutorial.md b/docs/en/tutorial.md index d137267d9a4..91f1ea456a6 100644 --- a/docs/en/tutorial.md +++ b/docs/en/tutorial.md @@ -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: diff --git a/sidebars.js b/sidebars.js index 4b24c01e2c7..d26db17a672 100644 --- a/sidebars.js +++ b/sidebars.js @@ -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', ], }, {