# PostgreSQL - Export query result action
# Export query result
This bulk long action executes a SQL query and exports the results as a CSV file. If you are using a cloud connection, you can stream the exported CSV content via the File Contents datapill. When using a cloud connection, the maximum timeout is 120 minutes.
If you are using an OPA connection, you can upload the CSV file to a local directory or a cloud storage like an S3 bucket.
If the CSV file is uploaded to a local directory, the query results are processed and stored locally. This means that your data never leaves your secure network.
On-prem profile configuration
Remember to configure a staging area in your on-prem agent profile. Learn how to setup a staging area in the OPA server profile.
Export query result action (OPA)
Export query result action (Cloud)
# Input
| Input field | Description |
|---|---|
| SQL | A valid SQL query. for example, SELECT * FROM PUBLIC.ACCOUNTS |
| Column delimiter | Choose a delimiter character. CSV files typically use comma. |
| Upload URL (OPA connection only) | Export the CSV file to this URL. Generate this url using On-prem files or Amazon S3. |
# Output
| Output field | Description |
|---|---|
| Number of rows exported | The number of rows exported. |
| Column names | Column headers in the CSV file. |
| File Contents (Cloud connection only) | CSV stream of the contents of the file. |
Last updated: 5/21/2025, 5:22:32 AM