{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"JSONファイルからのレガシーバルクインポート","description":"JSONファイルからTreasure AIへのデータインポート方法を解説。Toolbeltのインストールと認証、JSONデータのアップロード手順を詳しく説明。","siteUrl":"https://docs.treasure.ai","lang":"en-US","jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.treasure.ai/","name":"Treasure AI","url":"https://www.treasure.ai/","logo":"https://www.treasure.ai/hubfs/assets/images/logos/primary-logo.svg"},{"@type":"WebSite","@id":"https://docs.treasure.ai/#website","name":"Treasure AI Documentation","url":"https://docs.treasure.ai/","inLanguage":["en","ja"],"publisher":{"@id":"https://www.treasure.ai/"}}]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"jsonファイルからのレガシーバルクインポート","__idx":0},"children":["JSONファイルからのレガシーバルクインポート"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["この記事では、JSONファイルからTreasure Dataにデータをインポートする方法について説明します。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"bulk-loaderのインストール","__idx":1},"children":["Bulk Loaderのインストール"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["お使いのコンピュータに",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/"},"children":["Toolbelt"]},"をインストールしてください。Toolbeltには、当社のbulk loaderプログラムが含まれています。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/win"},"children":["Toolbelt Installer for Windows"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/mac"},"children":["Toolbelt Installer for Mac OS X"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tools/cli-and-sdks/quickstart"},"children":["Toolbelt Installer for Linux"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["インストール後、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td"]},"コマンドがコンピュータで使用できるようになります。ターミナルを開き、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td"]},"と入力してコマンドを実行してください。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["JAVA"]},"がインストールされていることを確認してください。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td import:jar_update"]},"を実行して、bulk loaderの最新バージョンをダウンロードします。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td\nusage: td [options] COMMAND [args]\n$ java\nUsage: java [-options] class [args...]\n$ td import:jar_update\nInstalled td-import.jar 0.x.xx into /path/to/.td/java\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"認証","__idx":2},"children":["認証"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure アカウントにログインします。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td account -f\nEnter your Treasure Data credentials.\nEmail: xxxxx\nPassword (typing will be hidden):\nAuthenticated successfully.\nUse 'td db:create db_name' to create a database.\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"jsonからデータをインポートする","__idx":3},"children":["JSONからデータをインポートする"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.json"]},"というファイルがあり、その内容が次の例のようになっている場合:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ head -n 1 data.json\n{\"host\":\"224.225.147.72\",\"user\":\"-\",\"method\":\"GET\",\"path\":\"/category/electronics\",\"code\":200,\"referer\":\"-\",\"size\":43,\"agent\":\"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\",\"date_time\":\"2004-03-07 16:05:49\"}\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["次のコマンドを実行してJSONファイルをアップロードします:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td db:create my_db\n$ td table:create my_db my_tbl\n$ td import:auto \\\n  --format json \\\n  --time-column date_time \\\n  --time-format \"%Y-%m-%d %H:%M:%S\" \\\n  --auto-create my_db.my_tbl \\\n  ./data.json\n"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td import:auto"]},"は、無効な行をチェックするためにMapReduceジョブを実行するため、最低でも",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1～2分"]},"かかります。"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| --- |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["上記のコマンドでは、次のことを前提としています:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["データファイルは",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.json"]},"という名前で、現在のディレクトリにある(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./data.json"]},")"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["JSON形式では通常、列名が指定されます。指定されていない場合は、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--columns"]},"オプションで列名を指定する必要があります(オプションで",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--column-types"]},"オプションで列の型を指定することもできます)。または、ファイル内の各列に対して",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--column-types"]},"を使用します。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["時刻フィールドは\"date_time\"という名前で、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--time-column"]},"オプションで指定されています"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["時刻フォーマットは",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["%Y-%m-%d %H:%M:%S"]},"で、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--time-format"]},"オプションで指定されています"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ネストされたjsonレコードの処理","__idx":4},"children":["ネストされたJSONレコードの処理"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ネストされたJSONレコードは、HiveのネイティブUDF関数である",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF"},"children":["get_json_object"]},"またはPrestoのネイティブ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://trino.io/docs/423/functions/json.html"},"children":["JSON関数"]},"を使用して解析できます。ただし、追加のCPUパフォーマンスオーバーヘッドを避けるために、フラットなJSON構造を維持することをお勧めします。"]}]},"headings":[{"value":"JSONファイルからのレガシーバルクインポート","id":"jsonファイルからのレガシーバルクインポート","depth":1},{"value":"Bulk Loaderのインストール","id":"bulk-loaderのインストール","depth":1},{"value":"認証","id":"認証","depth":1},{"value":"JSONからデータをインポートする","id":"jsonからデータをインポートする","depth":2},{"value":"ネストされたJSONレコードの処理","id":"ネストされたjsonレコードの処理","depth":2}],"frontmatter":{"seo":{"title":"JSONファイルからのレガシーバルクインポート","description":"JSONファイルからTreasure AIへのデータインポート方法を解説。Toolbeltのインストールと認証、JSONデータのアップロード手順を詳しく説明。"}},"lastModified":"2026-06-17T07:22:53.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/int/legacy-bulk-import-from-json-file","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}