Export Sql query result to csv
Activity | exportToCsv |
---|---|
Description | Extract data from a DbStore into a CSV file |
Input :
PropertyName | Rule of use (if revelant) | Type | Required | Default Value | Description |
---|---|---|---|---|---|
connectionName | STRING | YES | name of the source connection (see DbStore) | ||
QueryFileToken | If QueryFileToken is filled in, the content of the file specified will be used instead of Query | STRING | YES | Filetoken containing the query to execute | |
Query | STRING | SQL Query to execute | |||
Params | PARAMETERS ARRAY | NO | Query parameters | ||
CommandTimeout | INT | NO | Execution timeout of the SQL query in the database | ||
Separator | CHAR | NO | ';' | CSV output separator | |
OutputFileStoreName | STRING | YES | Output fileStore name | ||
OutputFileName | STRING | YES | Name of the output file (.csv extension will be added automatically) | ||
OutputFileEncoding | STRING | NO | Default is UTF-8 (See here https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding?view=net-9.0 for possible values) | ||
OutputFileCulture | STRING | NO | Default is Invariant Culture (See https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.name?view=net-9.0#system-globalization-cultureinfo-name for possible values) |
Parameters
PropertyName | Type | Required | Default Value | Description |
---|---|---|---|---|
Name | STRING | YES | name of the parameter | |
Value | STRING | NO | value of the parameter |
Output
CSV file token
Example1: Export Simple query in CSV
Input
{
"connectionName": "dbStore1",
"query":"SELECT name, role FROM employees"
"outputFileStoreName": "ftp1",
"outputFileName": "employees"
}
Output
ftp://ftp1/employees.csv
File content
"name";"role"
"bob";"sales"
"frank";"operations"
"billie";"board"