From a939fb5f47a33da7a153e92e6b8c0d5c610638f5 Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Fri, 26 Jan 2024 12:54:55 +0000 Subject: [PATCH] add to jdbc --- website/docs/docs/dbt-cloud-apis/sl-jdbc.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/website/docs/docs/dbt-cloud-apis/sl-jdbc.md b/website/docs/docs/dbt-cloud-apis/sl-jdbc.md index 2e928db6af2..ec48aa0f885 100644 --- a/website/docs/docs/dbt-cloud-apis/sl-jdbc.md +++ b/website/docs/docs/dbt-cloud-apis/sl-jdbc.md @@ -413,6 +413,24 @@ semantic_layer.query(metrics=['food_order_amount', 'order_gross_profit'], }} ``` +You can compile SQL with a [saved query](/docs/build/saved-queries) using the following example: + +```sql +select * from {{ semantic_layer.query(saved_query="new_customer_orders", limit=5, compile=True}} +``` + +In the previous saved query example, the `compile=True` argument indicates that the SQL will be compiled using a saved query before executed. This means the JDBC API will first translate the saved query (`new_customer_orders`) into executable SQL code and then apply the limit of 5 records. + +### Query a saved query + +Use the following example to query a [saved query](/docs/build/saved-queries): + +```sql +select * from {{ semantic_layer.query(saved_query="new_customer_orders", limit=5}} +``` + +The JDBC API will use the saved query (`new_customer_orders`) as defined and apply a limit of 5 records. + ## FAQs