{"id":16644837,"url":"https://github.com/toyama0919/embulk-filter-mysql","last_synced_at":"2025-07-05T09:34:52.983Z","repository":{"id":62557889,"uuid":"57031787","full_name":"toyama0919/embulk-filter-mysql","owner":"toyama0919","description":null,"archived":false,"fork":false,"pushed_at":"2017-03-31T07:57:38.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T08:31:58.701Z","etag":null,"topics":["embulk","embulk-plugin","mysql","prepared-statements"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/toyama0919.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-25T10:06:32.000Z","updated_at":"2018-10-01T01:20:37.000Z","dependencies_parsed_at":"2022-11-03T06:45:24.687Z","dependency_job_id":null,"html_url":"https://github.com/toyama0919/embulk-filter-mysql","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyama0919%2Fembulk-filter-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyama0919%2Fembulk-filter-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyama0919%2Fembulk-filter-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyama0919%2Fembulk-filter-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toyama0919","download_url":"https://codeload.github.com/toyama0919/embulk-filter-mysql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238968187,"owners_count":19560585,"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":["embulk","embulk-plugin","mysql","prepared-statements"],"created_at":"2024-10-12T08:12:26.556Z","updated_at":"2025-02-15T08:30:51.400Z","avatar_url":"https://github.com/toyama0919.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mysql filter plugin for Embulk\n[![Gem Version](https://badge.fury.io/rb/embulk-filter-mysql.svg)](http://badge.fury.io/rb/embulk-filter-mysql)\n\nMysql filter plugin for Embulk. Execute prepared statements query.\n\n## Overview\n\n* **Plugin type**: filter\n\n## Configuration\n\n- **host**: host(string, default: 'localhost')\n- **user**: user(string, required)\n- **password**: password(string, required)\n- **database**: database(string, required)\n- **port**: port(integer, default: 3306)\n- **query**: query(string, required)\n- **params**: params(array, required)\n- **keep_input**: keep_input(bool, default: true)\n\n## Example\n\n```yaml\nin:\n  type: s3\n  bucket: machine-learning-production\n  path_prefix: customer-approval/batch-prediction/result/\n  endpoint: s3.amazonaws.com\n  auth_method: {{ env.EMBULK_S3_AUTH_METHOD }}\n  decoders:\n  - {type: gzip}\n  parser:\n    type: csv\n    delimiter: \",\"\n    skip_header_lines: 1\n    allow_extra_columns: true\n    allow_optional_columns: true\n    columns:\n      - {name: user_id, type: long}\n      - {name: trueLabel, type: string}\n      - {name: bestAnswer, type: string}\n      - {name: score, type: double}\nfilters:\n  - type: mysql\n    host: {{ env.DATABASE_HOST | default: \"localhost\" }}\n    user: {{ env.APPLICATION_USERNAME }}\n    password: {{ env.APPLICATION_DATABASE_PASS }}\n    database: {{ env.APPLICATION_DATABASE }}\n    keep_input: true\n    query: |\n      select \n        id,\n        last_name,\n        first_name,\n        company_name\n      from\n        user\n      where id = ?\n    params:\n      - user_id\nout:\n  type: stdout\n```\n\n#### input CSV\n```\nuser_id,trueLabel,bestAnswer,score\n1,0,0,1.5\n2,0,0,1.5\n3,0,0,1.5\n```\n\n#### Running query\n```\n  select \n    id,\n    last_name,\n    first_name,\n    company_name\n  from\n    user\n  where id = 1;\n\n  select \n    id,\n    last_name,\n    first_name,\n    company_name\n  from\n    user\n  where id = 2;\n\n  select \n    id,\n    last_name,\n    first_name,\n    company_name\n  from\n    user\n  where id = 3;\n```\n\n\n## Build\n\n```\n$ rake\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoyama0919%2Fembulk-filter-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoyama0919%2Fembulk-filter-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoyama0919%2Fembulk-filter-mysql/lists"}