> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-pipeline/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-pipeline/components/transformations/sql-component.md).

# SQL Component

The  SQL component serves as a bridge between the extracted data and the desired transformed data, leveraging the power of SQL queries and database systems to enable efficient data processing and manipulation.

It also provides an option of using aggregation functions on the complete streaming data processed by the component. The user can use SQL transformations on Spark data frames with the help of this component.&#x20;

All component configurations are classified broadly into the following sections:

* ​[​Basic Information​](/data-pipeline/components/component-base-configuration.md)​
* Meta Information
* ​[Resource Configuration​](/data-pipeline/components/resource-configuration.md)​

{% hint style="success" %}
*Follow the given steps in the demonstration to configure the SQL transformation component.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fuq3RSHHup7fjHYaspk7y%2Fuploads%2FOF7Tl4otPuqeMgmsbgTE%2Fsql%20component%20(online-video-cutter.com).mp4?alt=media&token=9562280f-9dee-487c-80e7-5fcfccb3b2bd>" %}
Configuring the SQL Transformation component
{% endembed %}

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The schema file that can be uploaded here is a JSON spark schema.*
{% endhint %}

## Configuring Meta Information of SQL Component.

<figure><img src="/files/UQlrDU2Pe1VDtnXDd8i7" alt=""><figcaption></figcaption></figure>

1. **Query Type:** There are two options available under this field:
   * **Batch Query:** When this option is selected, then there is no need to upload schema file.
   * **Aggregate Query:** When this option is selected, it is mandatory to upload the spark schema file in JSON format of the in-event data.
2. **Schema File name:** Upload the spark schema file in JSON format when Aggregate query is selected in the query type field.
3. **Table name:** Provide the table name
4. **Query:** Write a SQL query in this field.                                                  &#x20;
5. **Selected Columns:** select the column name from the table, provide the Alias name and the desired data type for that column.

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The SQL component, when set to Aggregate Query mode and connected to DB Sync, will not write data to the DB Sync event.*
{% 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:

```
GET https://docs.bdb.ai/data-pipeline/components/transformations/sql-component.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.
