> For the complete documentation index, see [llms.txt](https://docs.tailer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tailer.ai/data-pipeline-operations/export-data-with-tables-to-storage/table-to-storage-sql-file.md).

# Table to Storage SQL file

To run a Table to Storage data operation, you first need to prepare a SQL query that will extract the data to export.

The SQL file must contains a BigQuery Standard SQL query. You can write it directly in the query editor of [BigQuery](https://console.cloud.google.com/bigquery) and then save it to a .sql file.

Example:

```sql
SELECT * FROM 'myproject.datalake.sales'
```

This query will be executed when the data operation is deployed, and the result will display in the CSV export file and the table copy if specified.

{% hint style="info" %}
You can now use constants with context but **only if** you stated version :"3" in the global parameters of the configuration **and if** your tailer SDK version is 1.3.9 or later. See [here](https://docs.tailer.ai/data-pipeline-operations/set-constants-with-context) for the constants with context. For example:

```
SELECT * FROM {{SOURCE_DATASET}}.sales
```

{% endhint %}


---

# 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://docs.tailer.ai/data-pipeline-operations/export-data-with-tables-to-storage/table-to-storage-sql-file.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.
