{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Integrations","type":"markdown"},"seo":{"title":"Embulk Bulk Import From MySQL","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"embulk-bulk-import-from-mysql","__idx":0},"children":["Embulk Bulk Import From MySQL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This article explains how to import data from MySQL database to Treasure Data using embulk-input-mysql input plugin."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Basic knowledge of Treasure Data."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Basic knowledge of ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.embulk.org/docs/"},"children":["Embulk"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Embulk is a Java application. Make sure that Java is installed."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Follow the instructions in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/integration-hub/batch/import/bulk-data-import#installing-bulk-data-import"},"children":["Installing Bulk Data Import"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.embulk.org/docs/"},"children":["Embulk and embulk-output-td plugin"]}," installed on your machine."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"install-embulk-input-mysql-plugin","__idx":2},"children":["Install embulk-input-mysql Plugin"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To install embulk-input-mysql plugin, run the following command:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"embulk gem install embulk-input-mysql\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"create-a-seed-configuration-file","__idx":3},"children":["Create a Seed Configuration File"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Using your favorite text editor, create Embulk config file (for eg:seed.yml) defining input(MySQL) and output(TD) parameters. Example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"in:\n  type: mysql\n  host: localhost\n  port: 3306\n  user: username\n  password: password\n  database: mysql_db\n  table: my_table\n  select: 'col1, col2, datecolumn'\n  where: col4 != 'a'\nout:\n  type: td\n  apikey: xxxxxxxxxxxx\n  endpoint: api.treasuredata.com\n  database: dbname\n  table: tblname\n  time_column: datecolumn\n  mode: replace\n  default_timestamp_format: '%d/%m/%Y'\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For further details about additional parameters and other examples are available, refer ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/embulk/embulk-input-jdbc/tree/master/embulk-input-mysql"},"children":["Embulk Input MySQL"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"guess-fields-generate-loadyml","__idx":4},"children":["Guess Fields (Generate load.yml)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Embulk guess option uses ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["seed.yml"]}," to read the target file and automatically guesses the column types/settings and creates a new file ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["load.yml"]}," with this information."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"embulk guess seed.yml -o load.yml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can preview the data using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["embulk preview load.yml"]}," command. If any of the column types or data seems incorrect you may edit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["load.yml"]}," file directly and preview again to verify. If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["guess"]}," option doesn’t yield satisfactory results, you may change parameters in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["load.yml"]}," according to your requirement."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"execute-load-job","__idx":5},"children":["Execute Load Job"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue the import job by running the following command:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"embulk run load.yml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["It may take few mins to hours for the job to complete, depending on the size of the data."]}]},"headings":[{"value":"Embulk Bulk Import From MySQL","id":"embulk-bulk-import-from-mysql","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Install embulk-input-mysql Plugin","id":"install-embulk-input-mysql-plugin","depth":2},{"value":"Create a Seed Configuration File","id":"create-a-seed-configuration-file","depth":2},{"value":"Guess Fields (Generate load.yml)","id":"guess-fields-generate-loadyml","depth":2},{"value":"Execute Load Job","id":"execute-load-job","depth":1}],"frontmatter":{"seo":{"title":"Embulk Bulk Import From MySQL"}},"lastModified":"2026-06-02T03:56:21.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/int/embulk-bulk-import-from-mysql","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}