FRENDS Community Task for SQL query results to CSV-file
You can install the task via FRENDS UI Task View or you can find the NuGet package from the following NuGet feed https://www.myget.org/F/frends-community/api/v3/index.json and in Gallery view in MyGet https://www.myget.org/feed/frends-community/package/nuget/Frends.Community.SQL
Property | Type | Description | Example |
---|---|---|---|
Query | string | SQL query to execute | SELECT id FROM foo |
ConnectionString | string | Database connection string | Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword |
TimeoutSeconds | int | Timeout in seconds | 30 |
OutputFilePath | string | CSV file path for output | C:\output\path.csv |
QueryParameters | SQLParameter[] | Query parameters | [ { "@Param1", "Value1" }, { "@Param2", "Value2" }] |
Settings for included attachments
Property | Type | Description | Example |
---|---|---|---|
ColumnsToInclude | string[] | Columns to include in the output CSV. If no columns defined here then all columns will be written to output CSV. | [id, name, value] |
FieldDelimiter | enum { Comma, Semicolon, Pipe } | Field delimeter to use in output CSV | Comma |
LineBreak | enum { CR, LF, CRLF } | Line break style to use in output CSV. | CRLF |
FileEncoding | enum | Encoding for the read content. By selecting 'Other' you can use any encoding. | |
EncodingInString | string | The name of encoding to use. Required if the FileEncoding choice is 'Other'. A partial list of supported encoding names: https://msdn.microsoft.com/en-us/library/system.text.encoding.getencodings(v=vs.110).aspx | iso-8859-1 |
IncludeHeadersInOutput | bool | Wherther to include headers in output CSV. | true |
SanitizeColumnHeaders | bool | Whether to sanitize headers in output: (1) Strip any chars that are not 0-9, a-z or _ (2) Make sure that column does not start with a number or underscore (3) Force lower case | true |
AddQuotesToDates | bool | Whether to add quotes around DATE and DATETIME fields | true |
DateFormat | string | Date format to use for formatting DATE columns, use .NET formatting tokens. Note that formatting is done using invariant culture. | yyyy-MM-dd |
DateTimeFormat | string | Date format to use for formatting DATETIME columns, use .NET formatting tokens. Note that formatting is done using invariant culture. | yyyy-MM-dd HH:mm:ss |
Newlines in text fields are replaced with spaces.
Result contains the amount of lines written to output CSV.
This project is licensed under the MIT License - see the LICENSE file for details
Clone a copy of the repo
git clone https://github.com/CommunityHiQ/Frends.Community.SQL.git
Build the project
dotnet build
Run Tests
dotnet test
Create a nuget package
dotnet pack --configuration Release
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
Version | Changes |
---|---|
1.1.1 | Migration from Frends.Community.SQL.QueryToFile. Converted to support .Net Framework 4.7.1 and .Net Standard 2.0. Renamed task. |
1.1.2 | Updated README and changed CI to create release in GitHub. |
1.1.3 | Updated dependencies System.ComponentModel.Annotations to 5.0.0 and CsvHelper to 27.1.1, also replaced MSTest.TestAdapter and MSTest.TestFramework with NUnit.Framework. |