{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"TD Toolbeltを使用したスケジューリング","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":"td-toolbeltを使用したスケジューリング","__idx":0},"children":["TD Toolbeltを使用したスケジューリング"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Dataには、定期的なクエリ実行をサポートするスケジューラー機能があります。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#prerequisites"},"children":["前提条件"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#create-a-new-schedule-using-td-toolbelt"},"children":["TD Toolbeltを使用した新規スケジュールの作成"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#setting-the-priority-of-scheduled-jobs-using-td-toolbelt"},"children":["TD Toolbeltを使用したスケジュールジョブの優先度設定"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#example-periodic-aggregation"},"children":["例：定期的な集約"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#viewing-schedules-using-td-toolbelt"},"children":["TD Toolbeltを使用したスケジュールの表示"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#viewing-the-history-of-a-job"},"children":["ジョブの履歴の表示"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#example"},"children":["例："]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#update-the-schedule"},"children":["スケジュールの更新"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#unschedule-the-job"},"children":["ジョブのスケジュール解除"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#delete-the-schedule"},"children":["スケジュールの削除"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"前提条件","__idx":1},"children":["前提条件"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tools/cli-and-sdks/quickstart"},"children":["TD Toolbelt"]},"を含むTreasure Dataの基礎知識"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["データが格納されているテーブル"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"td-toolbeltを使用した新規スケジュールの作成","__idx":2},"children":["TD Toolbeltを使用した新規スケジュールの作成"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["新しいスケジュールは、td sched:createコマンドを使用して作成できます。スケジュールの名前、cron形式のスケジュール、クエリ、およびデータベース名が必要です。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td sched:create <name> <cron> [sql]\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"options:\n\n-d, --database DB_NAME データベースを使用（必須）\n\n-t, --timezone TZ タイムゾーンの名前。拡張タイムゾーンのみサポート\n\n-D, --delay SECONDS スケジュールの遅延時間\n\n-r, --result RESULT_URL 結果をURLに書き込む（result:createサブコマンドも参照）\n\n-u, --user NAME 結果URLのユーザー名を設定\n\n-p, --password 結果URLのパスワードを要求\n\n-P, --priority PRIORITY 優先度を設定\n\n-q, --query PATH インラインクエリの代わりにファイルを使用\n\n-R, --retry COUNT 自動再試行回数\n\n-T, --type TYPE クエリタイプを設定（hive）\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["例："]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/scheduling-using-the-td-toolbelt-2024-02-13.420ebe5b77f51fdf190b0e6fa85b4a3ab5d9d7f9881bea6d9c0badcaa944e5e4.b40d6bf5.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"td-toolbeltを使用したスケジュールジョブの優先度設定","__idx":3},"children":["TD Toolbeltを使用したスケジュールジョブの優先度設定"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ジョブの優先度を変更するには、次を使用します："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:update <job_name> -P <#>"]}]},{"$$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":"strong","attributes":{},"children":["優先度"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["構文オプション値"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["非常に高い"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-P 2"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["通常"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-P 0"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["非常に低い"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-P -2"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["例："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:update 111_beta_query_01 -P 2"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"例定期的な集約","__idx":4},"children":["例：定期的な集約"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["一般的なパターンは、メインテーブルから別のテーブルにデータを定期的に要約することです。この例では、アクセスログからのWebリクエスト結果を1時間ごとに集約します。集約の適切な時間範囲を設定するために、Presto（またはHive）のいくつかの一般的な関数を使用しています。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT\n  USER,\n  code,\n  method,\n  PATH,\n  agent,\n  HOST,\n  AVG(SIZE)\nFROM\n  www_access\nWHERE\n  TD_TIME_RANGE(time,\n    TD_TIME_ADD(TD_SCHEDULED_TIME(), '-1h'),\n    TD_SCHEDULED_TIME())\nGROUP BY\n  USER,\n  code,\n  method,\n  PATH,\n  agent,\n  HOST\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["クエリを1時間ごとに実行するように設定を完了するには、スケジュールされたクエリを作成します："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td sched:create \\\nhourly_agg \\\n\"@hourly\" \\\n-d testdb \\\n-D 1800 \\\n\"SELECT USER, code, method, PATH, agent, HOST, AVG(SIZE) FROM www_access WHERE TD_TIME_RANGE(time, TD_TIME_ADD(TD_SCHEDULED_TIME(), '-1h'), TD_SCHEDULED_TIME()) GROUP BY USER, code, method, PATH, agent, HOST\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["前述の例では、@hourlyはcronの",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0 * * * *"]},"と同じです。-Dパラメータを使用すると、遅延時間を秒単位で指定できます。この例では、1800秒（または30分の遅延）が設定されています。ジョブは毎時30分後に実行されます。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"td-toolbeltを使用したスケジュールの表示","__idx":5},"children":["TD Toolbeltを使用したスケジュールの表示"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["既存のスケジュールエントリのリストを表示するには、td sched:listを使用します。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ジョブの履歴の表示","__idx":6},"children":["ジョブの履歴の表示"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["td sched:historyは、スケジュールエントリのジョブ履歴を表示します。個々のジョブの結果を調査するには、td job ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<jobid>"]},"を使用します。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["定義されたスケジュールに従って実行されるジョブのリストを取得するには、次を使用します："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:list"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["定義されたスケジュールを持つジョブの1つの履歴を表示するには、次を使用します："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:history <name> [max]"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["例："]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/scheduling-using-the-td-toolbelt-2024-02-13-1.eb750a8970fbbd75914f0a00e2946e28c22fa96dcb824bba2ec1cc67dc63bea6.b40d6bf5.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"スケジュールの更新","__idx":7},"children":["スケジュールの更新"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["スケジュールされたクエリのほとんどの設定は、いつでも更新または再設定できます。「次回のスケジュール実行時刻」（「次回」または「次回のスケジュール」とも呼ばれます）は、ブラウザのタイムゾーンの現在時刻、cronスケジュール、および遅延設定に基づいて自動更新される推定設定です。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["スケジュールされたクエリが更新されると、更新された設定は、「次回のスケジュール実行時刻 + 遅延」（遅延が>0、<0、または0の場合）に発生する次回のスケジュール実行にすぐに適用されます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:update <name>"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["例："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:update sched1 -s \"0 */2 * * *\" -d my_db -t \"Asia/Tokyo\" -D 3600"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["options:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"-n, --newname NAME スケジュールの名前を変更\n\n-s, --schedule CRON スケジュールを変更\n\n-q, --query SQL クエリを変更\n\n-d, --database DB_NAME データベースを変更\n\n-r, --result RESULT_URL 結果のターゲットを変更（result:createサブコマンドも参照）\n\n-t, --timezone TZ タイムゾーンの名前。拡張タイムゾーンのみサポート\n\n-D, --delay SECONDS スケジュールの遅延時間を変更\n\n-P, --priority PRIORITY 優先度を設定\n\n-R, --retry COUNT 自動再試行回数\n\n-T, --type TYPE クエリタイプを設定（hive）\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ジョブのスケジュール解除","__idx":8},"children":["ジョブのスケジュール解除"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["特定のジョブのスケジュールを解除するには、次を使用します："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"* * * * *\"の代わりに\"\""]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["例："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$ td sched:update sched1 -s \"\" -d my_db -t \"Asia/Tokyo\" -D 3600"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["または"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$ td sched:create non_scheduled_query \"\" \"select count(*) from www_access\" -d sample_datasets"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"スケジュールの削除","__idx":9},"children":["スケジュールの削除"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["特定のジョブからスケジュールを削除するには、次を使用します："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:delete <name>"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["例："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$ td sched:delete hourly_count"]}]}]},"headings":[{"value":"TD Toolbeltを使用したスケジューリング","id":"td-toolbeltを使用したスケジューリング","depth":1},{"value":"前提条件","id":"前提条件","depth":2},{"value":"TD Toolbeltを使用した新規スケジュールの作成","id":"td-toolbeltを使用した新規スケジュールの作成","depth":2},{"value":"TD Toolbeltを使用したスケジュールジョブの優先度設定","id":"td-toolbeltを使用したスケジュールジョブの優先度設定","depth":2},{"value":"例：定期的な集約","id":"例定期的な集約","depth":1},{"value":"TD Toolbeltを使用したスケジュールの表示","id":"td-toolbeltを使用したスケジュールの表示","depth":2},{"value":"ジョブの履歴の表示","id":"ジョブの履歴の表示","depth":2},{"value":"スケジュールの更新","id":"スケジュールの更新","depth":2},{"value":"ジョブのスケジュール解除","id":"ジョブのスケジュール解除","depth":2},{"value":"スケジュールの削除","id":"スケジュールの削除","depth":2}],"frontmatter":{"seo":{"title":"TD Toolbeltを使用したスケジューリング"}},"lastModified":"2026-02-17T05:21:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/products/customer-data-platform/job-management/scheduling-using-the-td-toolbelt","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}