# SQL File Output

## <img src="/files/tTyEmNe0zhf3GBQzFyZp" alt="" data-size="line"> SQL File Output

### Description <a href="#description" id="description"></a>

The SQL File Output transform writes input data to a text file in the form of a set of SQL statements.

The SQL is generated in the dialect of the selected database.

| Hop Engine | <sup>✓</sup> |
| ---------- | ------------ |
| Spark      | ?            |
| Flink      | ?            |
| Dataflow   | ?            |

### Options

#### General Tab

| Option         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Transform name | Name of the transform.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Connection     | <ul><li>Connection : select the database for which you want to generate the SQL. The information in the connection is used to select the appropriate dialect.</li><li>Target schema : the schema of the table to generate the SQL for</li><li>Target table : the name of the table to generate the SQL for</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Output file    | <ul><li>Add create table statement : check this if you want the "CREATE TABLE" statement to be included in the generated SQL</li><li>Add truncate table statement: check this if the table is expected to exist and you want the "TRUNCATE TABLE" statement to be included in the generated SQL. Note that this could also be a "DELETE FROM" statement, depending on the database dialect.</li><li>Start new line for each statement : Enable this to increase the readability of the file</li><li>Filename : the filename (without file extension)</li><li>Create parent folder : if you want the parent folder of the specified file to be created if it doesn’t exist already.</li><li>Do not open create at start : if you don’t want an empty file in case there are no input rows</li><li>Extension : the required file extension ("sql" by default)</li><li>Include transformnr in filename : includes the transform number (when running in multiple copies) in the output filename</li><li>Include date in filename : includes the date in the output filename with format yyyyMMdd (20081231)</li><li>Include time in filename : includes the date in the output filename with format HHmmss (235959)</li><li>Append : append the generated SQL to the existing file</li><li>Split every …​ rows : limits the size of a single file by starting a new one every …​ rows.</li><li>Show filenames : hit this button to see the complete filename after assembly of the various parts (filename, extension, transformnr, date and time)</li><li>Add File to result: Adds the filenames written to the result of this pipeline. A unique list is being kept in memory that can be used in the next workflow action in a workflow, for example in another pipeline.</li></ul> |

#### Content Tab

| Option      | Description                                  |
| ----------- | -------------------------------------------- |
| Date format | Allows you to specify the date format.       |
| Encoding    | Allows you to specify the text file encoding |


---

# Agent Instructions: 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:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/sqlfileoutput.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
