{"id":21611297,"url":"https://github.com/runnerty/executor-sqlserver","last_synced_at":"2025-08-03T00:33:01.384Z","repository":{"id":33118195,"uuid":"147645764","full_name":"runnerty/executor-sqlserver","owner":"runnerty","description":"Runnerty module:  Microsoft SQL Server executor","archived":false,"fork":false,"pushed_at":"2023-08-09T09:05:27.000Z","size":692,"stargazers_count":2,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-16T02:18:02.260Z","etag":null,"topics":["csv","runnerty","sql-server","xlsx"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/runnerty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-06T08:56:23.000Z","updated_at":"2023-02-16T13:25:31.000Z","dependencies_parsed_at":"2024-11-24T21:12:02.052Z","dependency_job_id":"063e6c32-d6ab-4e47-bc08-50b16cfa1059","html_url":"https://github.com/runnerty/executor-sqlserver","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.4285714285714286,"last_synced_commit":"c41a101a3a8590a211cd455713c5b00422460357"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/runnerty/executor-sqlserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-sqlserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-sqlserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-sqlserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-sqlserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runnerty","download_url":"https://codeload.github.com/runnerty/executor-sqlserver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-sqlserver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268479698,"owners_count":24256877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","runnerty","sql-server","xlsx"],"created_at":"2024-11-24T21:11:53.271Z","updated_at":"2025-08-03T00:33:01.323Z","avatar_url":"https://github.com/runnerty.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://runnerty.io\"\u003e\n    \u003cimg height=\"257\" src=\"https://runnerty.io/assets/header/logo-stroked.png\"\u003e\n  \u003c/a\u003e\n  \u003cp align=\"center\"\u003eSmart Processes Management\u003c/p\u003e\n\u003c/p\u003e\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Dependency Status][david-badge]][david-badge-url]\n\u003ca href=\"#badge\"\u003e\n\u003cimg alt=\"code style: prettier\" src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg\"\u003e\n\u003c/a\u003e\n\n# Microsoft SQL Server executor for [Runnerty]:\n\n### Installation:\n\nThrough NPM\n\n```bash\nnpm i @runnerty/executor-sqlserver\n```\n\nYou can also add modules to your project with [runnerty]\n\n```bash\nnpx runnerty add @runnerty/executor-sqlserver\n```\n\nThis command installs the module in your project, adds example configuration in your [config.json] and creates an example plan of use.\n\nIf you have installed [runnerty] globally you can include the module with this command:\n\n```bash\nrunnerty add @runnerty/executor-sqlserver\n```\n\n### Configuration:\n\nAdd in [config.json]:\n\n```json\n{\n  \"id\": \"sqlserver_default\",\n  \"type\": \"@runnerty-executor-sqlserver\",\n  \"user\": \"sa\",\n  \"password\": \"yourStrong(!)Password\",\n  \"database\": \"master\",\n  \"server\": \"localhost\",\n  \"port\": 1433\n}\n```\n\n```json\n{\n  \"id\": \"sqlserver_default\",\n  \"type\": \"@runnerty-executor-sqlserver\",\n  \"user\": \"sa\",\n  \"password\": \"yourStrong(!)Password\",\n  \"database\": \"master\",\n  \"server\": \"localhost\",\n  \"port\": 1433,\n  \"options\": {\n    \"useUTC\": true\n  }\n}\n```\n\n#### Configuration params:\n\n| Parameter              | Description                                                                                                                              |\n| :--------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- |\n| user                   | The sqlserver user to authenticate as.                                                                                                   |\n| password               | The password of that sqlserver user.                                                                                                     |\n| database               | Name of the database to use for this connection. (Optional)                                                                              |\n| server                 | The hostname of the database you are connecting to.                                                                                      |\n| port                   | The port number to connect to. (Default: 3306)                                                                                           |\n| domain                 | Once you set domain, driver will connect to SQL Server using domain login.                                                               |\n| connectionTimeout      | Connection timeout in ms (default: 15000).                                                                                               |\n| requestTimeout         | Request timeout in ms (default: 15000).                                                                                                  |\n| pool.max               | The maximum number of connections there can be in the pool (default: 10).                                                                |\n| pool.min               | The minimum of connections there can be in the pool (default: 0).                                                                        |\n| pool.idleTimeoutMillis | The Number of milliseconds before closing an unused connection default: 30000).                                                          |\n| ssh.host               | Hostname or IP address of the ssh server.                                                                                                |\n| ssh.port               | Port number of the ssh server.                                                                                                           |\n| ssh.username           | Username for authentication on the ssh server.                                                                                           |\n| ssh.password           | Password for password-based user authentication on the ssh server.                                                                       |\n| ssh.privateKey         | Buffer or string that contains a private key for either key-based or hostbased user authentication (OpenSSH format).                     |\n| ssh.passphrase         | For an encrypted private key, this is the passphrase used to decrypt it.                                                                 |\n| ssh.srcHost            | Hostname or IP address of the source server for outbound forwarding.                                                                     |\n| ssh.srcPort            | Port number of the source server for outbound forwarding.                                                                                |\n| options                | get more information about the options in the module documentation [node-mssql](https://tediousjs.github.io/tedious/api-connection.html) |\n\n### Plan sample:\n\nAdd in [plan.json]:\n\n```json\n{\n  \"id\": \"sqlserver_default\",\n  \"command_file\": \"/etc/runnerty/sql/test.sql\"\n}\n```\n\n```json\n{\n  \"id\": \"sqlserver_default\",\n  \"command\": \"SELECT NOW()\"\n}\n```\n\n### Generation of files:\n\nThe saved can be indicated in the file of the results obtained from a query in csv, xlsx and json format. These files will be generated with streams.\nYou only have to indicate the corresponding property in the parameters:\n\n#### XLSX\n\nXLSX Format\n\n| Parameter      | Description                   |\n| :------------- | :---------------------------- |\n| xlsxFileExport | Path of xlsx file export.     |\n| xlsxAuthorName | Author file name. (Optional)  |\n| xlsxSheetName  | Name of the sheet. (Optional) |\n\nSample:\n\n```json\n{\n  \"id\": \"sqlserver_default\",\n  \"command\": \"SELECT * FROM USERS\",\n  \"xlsxFileExport\": \"./my_output.xlsx\",\n  \"xlsxAuthorName\": \"Runnerty\",\n  \"xlsxSheetName\": \"MySheetSample\"\n}\n```\n\n#### CSV\n\nCSV Format\n\n| Parameter                         | Description                                                                                                                                                                             |\n| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| csvFileExport                     | Path of csv file export.                                                                                                                                                                |\n| csvOptions/headers                | Type: boolean/string[]. The headers will be auto detected from the first row or you can to provide headers array: ['h1name','h2name',...].                                              |\n| csvOptions/delimiter              | Alternate delimiter. (Default: ',')                                                                                                                                                     |\n| csvOptions/quote                  | Alternate quote. (Default: '\"')                                                                                                                                                         |\n| csvOptions/alwaysWriteHeaders     | Set to true if you always want headers written, even if no rows are written. (Default: false)                                                                                           |\n| csvOptions/rowDelimiter           | Specify an alternate row delimiter (i.e \\r\\n). (Default: '\\n')                                                                                                                          |\n| csvOptions/quoteHeaders           | If true then all headers will be quoted. (Default: quoteColumns value)                                                                                                                  |\n| csvOptions/quoteColumns           | If true then columns and headers will be quoted (unless quoteHeaders is specified). (Default: false). More info [here.](https://c2fo.io/fast-csv/docs/formatting/options/#quotecolumns) |\n| csvOptions/escape                 | Alternate escaping value. (Default: '\"')                                                                                                                                                |\n| csvOptions/includeEndRowDelimiter | Set to true to include a row delimiter at the end of the csv. (Default: false)                                                                                                          |\n| csvOptions/writeBOM               | Set to true if you want the first character written to the stream to be a utf-8 BOM character. (Default: false)                                                                         |\n\nSample:\n\n```json\n{\n  \"id\": \"sqlserver_default\",\n  \"command\": \"SELECT * FROM USERS\",\n  \"csvFileExport\": \"@GV(WORK_DIR)/users.csv\",\n  \"csvOptions\": {\n    \"delimiter\": \";\",\n    \"quote\": \"\\\"\"\n  }\n}\n```\n\n#### JSON\n\nJSON Format\n\nSample:\n\n```json\n{\n  \"id\": \"sqlserver_sample\",\n  \"command\": \"SELECT * FROM USERS\",\n  \"fileExport\": \"@GV(WORK_DIR)/users.json\"\n}\n```\n\n### Loading files:\n\nFor file upload you must indicate the path of the csv file to be loaded in the `localInFile` parameter and the name of the table to load the data into in the `tableName` parameter. For example:\n\n```json\n{\n  \"id\": \"sqlserver_default\",\n  \"localInFile\": \"/sample.csv\"\n  \"tableName\": \"dbo.TABLE_NAME\"\n}\n```\n\n### Output (Process values):\n\n#### Standard\n\n- `PROCESS_EXEC_MSG_OUTPUT`: sqlserver output message.\n- `PROCESS_EXEC_ERR_OUTPUT`: Error output message.\n\n#### Query output\n\n- `PROCESS_EXEC_DATA_OUTPUT`: sqlserver query output data.\n- `PROCESS_EXEC_DB_COUNTROWS`: sqlserver query count rows.\n- `PROCESS_EXEC_DB_FIRSTROW`: sqlserver query first row data.\n- `PROCESS_EXEC_DB_FIRSTROW_[FILED_NAME]`: sqlserver first row field data.\n\nIf the process executes more than one query, it will be able to access its first row indicating its number in order, starting at zero. The first query corresponds to `PROCESS_EXEC_DB_FIRSTROW`, the next to `PROCESS_EXEC_DB_FIRSTROW_1` and so on.\nThe same is true for the rest of the values.\n\n#### Operation output\n\n- `PROCESS_EXEC_DB_AFFECTEDROWS`: sqlserver affected rows count.\n\nIf the process executes more than one operation, it will be able to access its first row indicating its number in order, starting at zero. The first operation corresponds to `PROCESS_EXEC_DB_AFFECTEDROWS`, the next to `PROCESS_EXEC_DB_AFFECTEDROWS_1` and so on.\n\n[runnerty]: http://www.runnerty.io\n[downloads-image]: https://img.shields.io/npm/dm/@runnerty/executor-sqlserver.svg\n[npm-url]: https://www.npmjs.com/package/@runnerty/executor-sqlserver\n[npm-image]: https://img.shields.io/npm/v/@runnerty/executor-sqlserver.svg\n[david-badge]: https://david-dm.org/runnerty/executor-sqlserver.svg\n[david-badge-url]: https://david-dm.org/runnerty/executor-sqlserver\n[config.json]: https://docs.runnerty.io/config/\n[plan.json]: https://docs.runnerty.io/plan/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnerty%2Fexecutor-sqlserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunnerty%2Fexecutor-sqlserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnerty%2Fexecutor-sqlserver/lists"}