Skip to content

Query Datasource

Description

The Query DataSource activity executes a structured query (e.g., SQL) against a configured data source such as a relational database, data warehouse, or cloud storage engine. You can retrieve the results directly as tabular output or optionally save them to a file using configurable export settings.

This activity is especially useful for dynamically pulling data into a workflow, generating reports, or integrating external data systems. When saving results to a file, it also supports advanced formatting using templates, encryption, and partitioning logic.

Use this activity to:

  • Query databases and bring live data into workflows
  • Export query results as Excel or CSV files
  • Apply formatting using templates and control sheet/row structure
  • Secure output files with encryption and filename customization

Use case: A data analyst can use this activity to run a sales report query on a PostgreSQL database. The output can be formatted using a template Excel file, encrypted using a secret key, and saved with a filename pattern that includes a timestamp.

Input

TypeDescription
DataOptional incoming data used to influence the query or filenames (if dynamic).

Output

Output TypeFormatDescription
DataTable or FileQuery results, either in-memory (as table) or written to file(s).

Configuration Fields

Field NameDescription
Datasource IdSelect the connection representing the data source (e.g., MySQL, SQL Server, Snowflake) where the query will run.
QueryThe query string (SQL or supported query language) to be executed on the selected data source. Supports variables if dynamic queries are needed.
Save As FileEnable this option to save the query result to a file instead of returning it as in-memory table data.
Secret KeyRequired only when “Save As File” is enabled. This encryption key secures the generated file’s content.
Sheet NameApplicable for Excel files. Specifies the sheet name where query results will be written.
File PatternA pattern to define the file name dynamically, such as using a timestamp or input variable (e.g., SalesReport_{Date}).
Template File PathOptional path to a template file (e.g., .xlsx) that provides a preformatted structure for the output file.
Template Sheet NameIf using a template, this defines the sheet within the template where data should be inserted.
Split By ColumnWhen specified, the output data will be split by distinct values in this column, producing separate files or sheets. Useful for grouped file output.
Start RowThe row index (1-based) in the output file or sheet from which the query results will begin writing.
Start ColumnThe column index (1-based) in the output file or sheet where the data writing should begin.

All file-related fields are only rendered when Save As File is enabled.

Sample Input

Not Applicable

Sample Configuration 1

FieldValue
Datasource Idpostgresql-sales-db
QuerySELECT * FROM orders WHERE status = 'Paid'
Save As FileDiabled

Sample Output

When Save As File is Disabled:

order_idcustomer_nameregionamountstatus
1001John SmithEast120.50Paid
1002Alice TaylorWest89.00Paid

Sample Configuration 2

FieldValue
Datasource Idpostgresql-sales-db
QuerySELECT * FROM orders WHERE status = 'Paid'
Save As FileDiabled
File Patternpaid_orders_{yyyyMMdd}.xlsx
Secret Keysecurekey123
Template File Path/templates/order_template.xlsx
Template Sheet NameOrders
Sheet NamePaid Orders
Start Row5
Start Column2
Split By Columnregion

Sample Output 2

When Save As File is Enabled: below data is written to sepcified file and downloadable file is populated

order_idcustomer_nameregionamountstatus
1001John SmithEast120.50Paid
1002Alice TaylorWest89.00Paid