# Table Input

The **Table Input** step reads information from a connected database using SQL statements. Basic SQL statements can be generated automatically by selecting **Get SQL select statement**.

### General

| Field          | Description                                                                                                                                                                                                            |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Step name**  | Specify the unique name of the Table Input step on the canvas. You can customize the name or leave it as the default.                                                                                                  |
| **Connection** | <p>Select the database connection to use.</p><p>If you do not have an existing connection, select <strong>New</strong> or <strong>Wizard</strong>. To modify an existing connection, select <strong>Edit</strong>.</p> |

### Options

| Option                             | Description                                                                                                                                                      |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **SQL**                            | SQL statement used to read data from the connected database. You can select **Get SQL select statement** to browse tables and generate a basic SELECT statement. |
| **Store column info in step meta** | Select to use cached metadata stored in the KTR instead of querying the database for table metadata.                                                             |
| **Enable lazy conversion**         | Select to avoid unnecessary data type conversions when possible (can improve performance).                                                                       |
| **Replace variables in script?**   | Select to replace variables in the SQL script. This is useful for testing with or without substitutions.                                                         |
| **Insert data from step**          | Specify the input step that provides parameter values. PDI inserts values at `?` markers in the SQL statement.                                                   |
| **Execute for each row?**          | Select to execute the query for each incoming row.                                                                                                               |
| **Limit size**                     | Number of rows to read. `0` means read all rows.                                                                                                                 |
| **Preview** (button)               | Opens a Preview window and shows a temporary execution log.                                                                                                      |

### Example

```sql
SELECT * FROM customers WHERE changed_date BETWEEN ? AND ?
```

This SQL statement requests two dates that are read from the **Insert data from step** input. You can provide the date range using the [Get System Info](/pdia-data-integration/pdi-transformation-steps-reference-overview/get-system-info.md) step.

### Metadata injection support

You can use [ETL metadata injection](/pdia-data-integration/pdi-transformation-steps-reference-overview/etl-metadata-injection.md) to pass metadata at runtime.

The following fields of the Table Input step support metadata injection:

* **SQL**
* **Limit size**
* **Execute for each row**
* **Replace variables in script**
* **Enable lazy conversion**
* **Cached row meta**
* **Connection**


---

# 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.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/table-input.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.
