> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/consume/v1/recipes/transpile-semantic-queries-to-native-warehouse-sql.md).

# Generate Native Warehouse SQL

Use this recipe when you want to inspect or reuse the native warehouse query generated from a Semantic SQL or Semantic REST request.

Set the query parameter `transpile_only=true`. The API translates the semantic query into the warehouse-native language and returns it directly.

{% hint style="info" %}
A transpile-only request does not execute the query and does not create a statement ID.

You do not need to poll the statement endpoint or retrieve results separately.
{% endhint %}

```
Semantic SQL / REST request
        └──► Transpile
                └──► Native warehouse query
```

## Transpile a Semantic SQL query

Add `transpile_only=true` to the Semantic SQL endpoint.

{% code title="Transpile-only Semantic SQL request" %}

```bash
curl --location \
  'https://<DATAOS_FQDN>/vulcan/tenants/<DATAOS_TENANT_ID>/data-products/<DATAOS_TENANT_ID>-<resource-name>/api/v1/query/semantic/sql?transpile_only=true' \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer ${DATAOS_TOKEN}" \
  --data '{
    "sql": "SELECT customer_profile.region_id, MEASURE(customer_profile.count) FROM customer_profile GROUP BY customer_profile.region_id LIMIT 10"
  }'
```

{% endcode %}

The API converts the Semantic SQL query into the native query language supported by the underlying warehouse.

For example, the generated query may use warehouse-specific:

* Table and column references
* Aggregation functions
* Quoting conventions
* Grouping logic
* Filters and limits

## Supported semantic query interfaces

The same parameter can be used with the supported semantic query endpoints.

### Semantic SQL

```
/api/v1/query/semantic/sql?transpile_only=true
```

### Semantic REST

```
/api/v1/query/semantic/rest?transpile_only=true
```

Use the request body required by the selected interface. Only the query format changes; the transpile-only behavior remains the same.

## How it differs from query execution

| Standard query execution | Transpile-only request          |
| ------------------------ | ------------------------------- |
| Executes the query       | Does not execute the query      |
| Creates a statement ID   | Does not create a statement ID  |
| Requires status polling  | Returns directly                |
| Produces query results   | Produces native warehouse SQL   |
| May use cached results   | Only performs query translation |

## Common use cases

Use `transpile_only=true` to:

* Inspect the native query before execution.
* Debug semantic query translation.
* Validate the SQL generated for a warehouse.
* Review filters, joins, aggregations, and grouping.
* Copy the generated query for testing in a warehouse client.
* Compare generated queries across different warehouses.

## Complete workflow

```
Send semantic query with transpile_only=true
        └──► Receive native warehouse SQL
                └──► Review, validate, or execute it separately
```

Because the query is not executed, no polling or result-download workflow is required.

## References

* [Query API reference](https://v2.dataos.info/references/interfaces/apis/data-product-apis/api-reference/query): `retry_on_recent_failure` and `transpile_only` on the Semantic REST/SQL endpoints
* [Retrieve large result sets with pagination](/consume/v1/recipes/retrieve-large-result-sets-with-pagination.md): for queries you do intend to execute and page through


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/consume/v1/recipes/transpile-semantic-queries-to-native-warehouse-sql.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
