{"id":15295763,"url":"https://github.com/runnerty/executor-mysql","last_synced_at":"2025-04-13T18:23:08.632Z","repository":{"id":19645696,"uuid":"87555406","full_name":"runnerty/executor-mysql","owner":"runnerty","description":"Runnerty module: Mysql executor","archived":false,"fork":false,"pushed_at":"2024-04-23T22:46:11.000Z","size":297,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-23T23:53:09.349Z","etag":null,"topics":["csv-export","executor","mysql","runnerty"],"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":"2017-04-07T14:34:08.000Z","updated_at":"2021-12-31T09:45:50.000Z","dependencies_parsed_at":"2024-04-23T23:47:48.501Z","dependency_job_id":null,"html_url":"https://github.com/runnerty/executor-mysql","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runnerty%2Fexecutor-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runnerty","download_url":"https://codeload.github.com/runnerty/executor-mysql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248759141,"owners_count":21157098,"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","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-export","executor","mysql","runnerty"],"created_at":"2024-09-30T18:08:00.950Z","updated_at":"2025-04-13T18:23:08.612Z","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]\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# MySQL executor for [Runnerty]:\n\n### Installation:\n\nThrough NPM\n\n```bash\nnpm i @runnerty/executor-mysql\n```\n\nYou can also add modules to your project with [runnerty]\n\n```bash\nnpx runnerty add @runnerty/executor-mysql\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-mysql\n```\n\n### Configuration:\n\nAdd in [config.json]:\n\n```json\n{\n  \"id\": \"mysql_default\",\n  \"type\": \"@runnerty-executor-mysql\",\n  \"user\": \"mysqlusr\",\n  \"password\": \"mysqlpass\",\n  \"database\": \"MYDB\",\n  \"host\": \"myhost.com\",\n  \"port\": \"3306\"\n}\n```\n\n```json\n{\n  \"id\": \"mysql_default\",\n  \"type\": \"@runnerty-executor-mysql\",\n  \"user\": \"mysqlusr\",\n  \"password\": \"mysqlpass\",\n  \"database\": \"MYDB\",\n  \"host\": \"myhost.com\",\n  \"port\": \"3306\",\n  \"ssl\": {\n    \"ca\": \"./ssl/my.ca\"\n  }\n}\n```\n\n#### Configuration params:\n\n| Parameter          | Description                                                                                                 |\n| :----------------- | :---------------------------------------------------------------------------------------------------------- |\n| user               | The MySQL user to authenticate as.                                                                          |\n| password           | The password of that MySQL user.                                                                            |\n| database           | Name of the database to use for this connection. (Optional)                                                 |\n| host               | The hostname of the database you are connecting to.                                                         |\n| port               | The port number to connect to. (Default: 3306)                                                              |\n| socketPath         | The path to a unix domain socket to connect to. When used host and port are ignored. (Optional)             |\n| charset            | The charset for the connection (collation). (Default: 'UTF8_GENERAL_CI')                                    |\n| timezone           | The timezone configured on the MySQL server. (Default: 'local')                                             |\n| insecureAuth       | Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false) |\n| flags              | Connection flags. More information [here](https://github.com/mysqljs/mysql#connection-flags).               |\n| multipleStatements | Allow multiple mysql statements per query. (Default: true)                                                  |\n| ssl/ca             | SSL CA File (Optional)                                                                                      |\n| ssl/cert           | SSL CERT File (Optional)                                                                                    |\n| ssl/key            | SSL KEY File (Optional)                                                                                     |\n\n### Plan sample:\n\nAdd in [plan.json]:\n\n```json\n{\n  \"id\": \"mysql_default\",\n  \"command_file\": \"/etc/runnerty/sql/test.sql\"\n}\n```\n\n```json\n{\n  \"id\": \"mysql_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\": \"mysql_sample\",\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\": \"mysql_sample\",\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\": \"mysql_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 file to be loaded in the `localInFile` parameter and in the `LOAD DATA LOCAL INFILE` statement you must indicate `mystream`. For example:\n\n- `localInFile`: Plain file path\n\n```json\n{\n  \"id\": \"mysql_sample\",\n  \"command\": \"LOAD DATA LOCAL INFILE 'mystream' INTO TABLE DBSAMPLE.TABLESAMPLE FIELDS TERMINATED BY ',' LINES TERMINATED BY '\\n'\",\n  \"localInFile\": \"/sample.csv\"\n}\n```\n\n### Output (Process values):\n\n#### Standard\n\n- `PROCESS_EXEC_MSG_OUTPUT`: MySQL output message.\n- `PROCESS_EXEC_ERR_OUTPUT`: Error output message.\n\n#### Query output\n\n- `PROCESS_EXEC_DATA_OUTPUT`: MySQL query output data.\n- `PROCESS_EXEC_DB_COUNTROWS`: MySQL query count rows.\n- `PROCESS_EXEC_DB_FIRSTROW`: MySQL query first row data.\n- `PROCESS_EXEC_DB_FIRSTROW_[FILED_NAME]`: MySQL first row field data.\n\n#### Operation output\n\n- `PROCESS_EXEC_DB_FIELDCOUNT`: MySQL field count.\n- `PROCESS_EXEC_DB_AFFECTEDROWS`: MySQL affected rows count.\n- `PROCESS_EXEC_DB_CHANGEDROWS`: MySQL changed rows count.\n- `PROCESS_EXEC_DB_INSERTID`: MySQL insert ID.\n- `PROCESS_EXEC_DB_WARNINGCOUNT`: MySQL warning count.\n- `PROCESS_EXEC_DB_MESSAGE`: MySQL message.\n\n[runnerty]: https://www.runnerty.io\n[downloads-image]: https://img.shields.io/npm/dm/@runnerty/executor-mysql.svg\n[npm-url]: https://www.npmjs.com/package/@runnerty/executor-mysql\n[npm-image]: https://img.shields.io/npm/v/@runnerty/executor-mysql.svg\n[david-badge]: https://david-dm.org/runnerty/executor-mysql.svg\n[david-badge-url]: https://david-dm.org/runnerty/executor-mysql\n[config.json]: http://docs.runnerty.io/config/\n[plan.json]: http://docs.runnerty.io/plan/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnerty%2Fexecutor-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunnerty%2Fexecutor-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnerty%2Fexecutor-mysql/lists"}