{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"FTP Import Integration CLI","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":"ftp-import-integration-cli","__idx":0},"children":["FTP Import Integration CLI"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["コマンドラインインターフェースからFTPデータコネクタを使用することもできます。以下の手順では、CLIを使用してデータをインポートする方法を説明します。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"td-command-v0119以降のインストール","__idx":1},"children":["'td' Command v0.11.9以降のインストール"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["最新の",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/"},"children":["TD Toolbelt"]},"をインストールしてください。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td --version\n0.11.10\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"seed設定ファイルの作成seedyml","__idx":2},"children":["Seed設定ファイルの作成（seed.yml）"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["まず、以下の例に示すように、FTPの詳細情報を含む",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["seed.yml"]},"を準備します。バケット名とターゲットファイル名（または複数ファイルのプレフィックス）も指定する必要があります。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"in:\n  type: ftp\n  host: ftp.example.net\n  port: 21\n  user: anonymous\n  password: XXXX\n  path_prefix: /ftp/file/path/prefix # FTPサーバー上の*.csvまたは*.tsvファイルのパス\nout:\n  mode: append\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Data Connector for FTPは、指定されたプレフィックスに一致するすべてのファイルをインポートします（例：path_prefix: path/to/sample_ > path/to/sample_201501.csv.gz, path/to/sample_201502.csv.gz, …, path/to/sample_201505.csv.gz）。"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Active Modeはサポートされていません。"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["FTPSを使用している場合は、次のように追加の詳細情報を指定します："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"in:\n  type: ftp\n  host: ftp.example.net\n  port: 21\n  user: anonymous\n  password: \"mypassword\"\n  path_prefix: /ftp/file/path/prefix\n  ssl: true\n  ssl_verify: false\nout:\n  mode: append\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["詳細については、",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/int/ftp-server-import-integration"},"children":["outプラグインのモード"]},"を参照してください。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"フィールドの推測loadymlの生成","__idx":3},"children":["フィールドの推測（load.ymlの生成）"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["connector:guess"]},"を使用します。このコマンドは、ソースファイルを自動的に読み取り、ファイル形式を評価（ロジックを使用して推測）します。"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["guessコマンドは、ソースデータファイルに3行以上、2列以上が必要です。これは、コマンドがソースデータのサンプル行を使用して列定義を評価するためです。"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td connector:guess seed.yml -o load.yml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["load.ymlを開くと、ファイル形式、エンコーディング、列名、型などの評価されたファイル形式定義が表示されます。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"in:\n  type: ftp\n  host: ftp.example.net\n  port: 21\n  user: anonymous\n  password: XXXX\n  path_prefix: /ftp/file/path/prefix\n  parser:\n    charset: UTF-8\n    newline: CRLF\n    type: csv\n    delimiter: ','\n    quote: '\"'\n    escape: ''\n    skip_header_lines: 1\n    columns:\n    - name: id\n      type: long\n    - name: company\n      type: string\n    - name: customer\n      type: string\n    - name: created_at\n      type: timestamp\n      format: '%Y-%m-%d %H:%M:%S'\nout:\n  mode: append\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["次に、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["preview"]}," コマンドを使用して、システムがファイルをどのように解析するかをプレビューできます。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td connector:preview load.yml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["システムがカラム名やカラムタイプを予期せず検出した場合は、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["load.yml"]}," を直接変更して再度プレビューしてください。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["現在、Data Connector は \"boolean\"、\"long\"、\"double\"、\"string\"、および \"timestamp\" タイプの解析をサポートしています。"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["データロードジョブを実行する前に、データベースとテーブルを作成する必要があります。次の手順に従ってください:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"td database:create td_sample_db\ntd table:create td_sample_db td_sample_table\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ロードジョブの実行","__idx":4},"children":["ロードジョブの実行"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["最後に、ロードジョブを送信します。データのサイズによっては数時間かかる場合があります。データを保存する Treasure Data のデータベースとテーブルを指定します。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Data のストレージは時間でパーティション分割されているため (",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.treasuredata.com/smart/project-product-documentation/data-partitioning-in-treasure-data"},"children":["データパーティショニング"]}," を参照)、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["--time-column"]}," オプションを指定することをお勧めします。オプションが指定されていない場合、Data Connector は最初の ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["long"]}," または ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["timestamp"]}," カラムをパーティショニング時間として選択します。",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["--time-column"]}," で指定するカラムのタイプは、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["long"]}," または ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["timestamp"]}," タイプのいずれかである必要があります。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["データに時間カラムがない場合は、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["add_time"]}," フィルターオプションを使用して時間カラムを追加できます。詳細については、",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.treasuredata.com/smart/project-product-documentation/add_time-filter-function"},"children":["add_time フィルタープラグイン"]}," を参照してください。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td connector:issue load.yml --database td_sample_db --table td_sample_table \\\n--time-column created_at\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["connector:issue コマンドは、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["database(td_sample_db)"]}," と ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["table(td_sample_table)"]}," が既に作成されていることを前提としています。データベースまたはテーブルが TD に存在しない場合、connector:issue コマンドは失敗するため、データベースとテーブルを手動で作成するか、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["td connector:issue"]}," コマンドで ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["--auto-create-table"]}," オプションを使用してデータベースとテーブルを自動作成してください:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td connector:issue load.yml --database td_sample_db --table td_sample_table --time-column created_at --auto-create-table\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["現在、Data Connector はサーバー側でレコードをソートしません。時間ベースのパーティショニングを効果的に使用するには、事前にファイル内のレコードをソートしてください。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["time"]}," というフィールドがある場合は、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["--time-column"]}," オプションを指定する必要はありません。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"td connector:issue load.yml --database td_sample_db --table td_sample_table\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"スケジュール実行","__idx":5},"children":["スケジュール実行"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["増分FTPファイルインポートのために、定期的なData Connector実行をスケジュールすることができます。高可用性を実現するため、スケジューラの分散と運用には細心の注意を払っています。この機能を使用することで、ローカルデータセンターの",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["cron"]},"デーモンは不要になります。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["スケジュールインポートでは、FTP用Data Connectorは最初に指定されたプレフィックスに一致するすべてのファイル（例：path_prefix: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path/to/sample_"]}," –> ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path/to/sample_201501.csv.gz"]},"、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path/to/sample_201502.csv.gz"]},"、…、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path/to/sample_201505.csv.gz"]},"）をインポートし、次回実行のために最後のパス（",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path/to/sample_201505.csv.gz"]},"）を記憶します。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["2回目以降の実行では、connectorはアルファベット順（辞書式順序）で最後のパスより後にあるファイルのみをインポートします。（",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path/to/sample_201506.csv.gz"]},"、…）"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"スケジュールの作成","__idx":6},"children":["スケジュールの作成"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["新しいスケジュールは",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["td connector:create"]},"コマンドを使用して作成できます。スケジュールの名前、cron形式のスケジュール、データが保存されるデータベースとテーブル、およびData Connector設定ファイルが必要です。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td connector:create \\\n    daily_import \\\n    \"10 0 * * *\" \\\n    td_sample_db \\\n    td_sample_table \\\n    load.yml\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Dataのストレージは時間によってパーティション分割されているため、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["--time-column"]},"オプションを指定することも推奨されます（",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.treasuredata.com/smart/project-product-documentation/data-partitioning-in-treasure-data"},"children":["データパーティショニング"]},"を参照）。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td connector:create \\\n    daily_import \\\n    \"10 0 * * *\" \\\n    td_sample_db \\\n    td_sample_table \\\n    load.yml \\\n    --time-column created_at\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cron"]},"パラメータは、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@hourly"]},"、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@daily"]},"、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@monthly"]},"の3つの特別なオプションも受け入れます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["デフォルトでは、スケジュールはUTCタイムゾーンで設定されます。-tまたは--timezoneオプションを使用して、タイムゾーンでスケジュールを設定できます。",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--timezone"]},"オプションは、'Asia/Tokyo'、'America/Los_Angeles'などの拡張タイムゾーン形式のみをサポートしていることに注意してください。PST、CSTなどのタイムゾーン略語は*サポートされておらず*、予期しないスケジュールになる可能性があります。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"スケジュールの一覧表示","__idx":7},"children":["スケジュールの一覧表示"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["td connector:list"]},"コマンドを実行すると、現在スケジュールされているエントリの一覧を確認できます。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td connector:list\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"設定とスケジュール履歴の表示","__idx":8},"children":["設定とスケジュール履歴の表示"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["td connector:show"]},"は、スケジュールエントリの実行設定を表示します。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"td connector:show daily_import\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["td connector:history"]},"は、スケジュールエントリの実行履歴を表示します。個々の実行結果を調査するには、",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["td job jobid"]},"を使用してください。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"td connector:history daily_import\n"},"children":[]}]},"headings":[{"value":"FTP Import Integration CLI","id":"ftp-import-integration-cli","depth":1},{"value":"'td' Command v0.11.9以降のインストール","id":"td-command-v0119以降のインストール","depth":2},{"value":"Seed設定ファイルの作成（seed.yml）","id":"seed設定ファイルの作成seedyml","depth":2},{"value":"フィールドの推測（load.ymlの生成）","id":"フィールドの推測loadymlの生成","depth":2},{"value":"ロードジョブの実行","id":"ロードジョブの実行","depth":2},{"value":"スケジュール実行","id":"スケジュール実行","depth":2},{"value":"スケジュールの作成","id":"スケジュールの作成","depth":3},{"value":"スケジュールの一覧表示","id":"スケジュールの一覧表示","depth":3},{"value":"設定とスケジュール履歴の表示","id":"設定とスケジュール履歴の表示","depth":2}],"frontmatter":{"seo":{"title":"FTP Import Integration CLI"}},"lastModified":"2026-01-09T05:58:30.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/int/ftp-import-integration-cli","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}